@@ -24,6 +24,7 @@ export async function POST(req: Request) {
|
|||||||
data: {
|
data: {
|
||||||
username: data.username,
|
username: data.username,
|
||||||
nomor: data.nomor,
|
nomor: data.nomor,
|
||||||
|
active: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,9 @@ import adminNotifikasi_countNotifikasi from "@/app_modules/admin/notifikasi/fun/
|
|||||||
import adminNotifikasi_getByUserId from "@/app_modules/admin/notifikasi/fun/get/get_notifikasi_by_user_id";
|
import adminNotifikasi_getByUserId from "@/app_modules/admin/notifikasi/fun/get/get_notifikasi_by_user_id";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import versionUpdate from "../../../../package.json";
|
import versionUpdate from "../../../../package.json";
|
||||||
|
import { redirect } from "next/navigation";
|
||||||
|
|
||||||
export default async function Layout({
|
export default async function Layout({
|
||||||
children,
|
children,
|
||||||
}: {
|
}: {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
@@ -14,10 +15,14 @@ export default async function Layout({
|
|||||||
const userLoginId = await funGetUserIdByToken();
|
const userLoginId = await funGetUserIdByToken();
|
||||||
const version = versionUpdate.version;
|
const version = versionUpdate.version;
|
||||||
|
|
||||||
const dataUser = await funGlobal_getUserById({ userId: userLoginId as string});
|
const dataUser = await funGlobal_getUserById({
|
||||||
const listNotifikasi = await adminNotifikasi_getByUserId({page: 1});
|
userId: userLoginId as string,
|
||||||
|
});
|
||||||
|
const listNotifikasi = await adminNotifikasi_getByUserId({ page: 1 });
|
||||||
const countNotifikasi = await adminNotifikasi_countNotifikasi();
|
const countNotifikasi = await adminNotifikasi_countNotifikasi();
|
||||||
|
|
||||||
|
if (dataUser?.masterUserRoleId == "1") return redirect("/dev/home");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Admin_NewLayout
|
<Admin_NewLayout
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
import { RouterAdminDashboard } from "@/app/lib/router_hipmi/router_admin";
|
|
||||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||||
import { HomeView } from "@/app_modules/home";
|
import { HomeView } from "@/app_modules/home";
|
||||||
import { user_getOneByUserId } from "@/app_modules/home/fun/get/get_one_user_by_id";
|
import { user_getOneByUserId } from "@/app_modules/home/fun/get/get_one_user_by_id";
|
||||||
import { job_getTwoForHomeView } from "@/app_modules/job/fun/get/get_two_for_home_view";
|
import { job_getTwoForHomeView } from "@/app_modules/job/fun/get/get_two_for_home_view";
|
||||||
import notifikasi_countUserNotifikasi from "@/app_modules/notifikasi/fun/count/fun_count_by_id";
|
import notifikasi_countUserNotifikasi from "@/app_modules/notifikasi/fun/count/fun_count_by_id";
|
||||||
import { redirect } from "next/navigation";
|
|
||||||
|
|
||||||
export default async function PageHome() {
|
export default async function PageHome() {
|
||||||
const userLoginId = await funGetUserIdByToken();
|
const userLoginId = await funGetUserIdByToken();
|
||||||
@@ -19,8 +17,8 @@ export default async function PageHome() {
|
|||||||
// return redirect(RouterHome.home_user_non_active);
|
// return redirect(RouterHome.home_user_non_active);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (dataUser?.masterUserRoleId === "2" || dataUser?.masterUserRoleId === "3")
|
// if (dataUser?.masterUserRoleId === "2" || dataUser?.masterUserRoleId === "3")
|
||||||
return redirect(RouterAdminDashboard.main_admin);
|
// return redirect(RouterAdminDashboard.main_admin);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -12,12 +12,18 @@ export default async function Layout({
|
|||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}) {
|
}) {
|
||||||
const userLoginId = await funGetUserIdByToken();
|
const userLoginId = await funGetUserIdByToken();
|
||||||
const activationUser = await funGlobal_checkActivationUseById({
|
// const dataUser = await funGlobal_getUserById({
|
||||||
userId: userLoginId as string,
|
// userId: userLoginId as string,
|
||||||
});
|
// });
|
||||||
|
|
||||||
|
// if (dataUser?.masterUserRoleId != "1") return redirect("/dev/home");
|
||||||
|
|
||||||
|
// const activationUser = await funGlobal_checkActivationUseById({
|
||||||
|
// userId: userLoginId as string,
|
||||||
|
// });
|
||||||
|
|
||||||
|
// if (activationUser == false) return redirect("/waiting-room");
|
||||||
|
|
||||||
if (activationUser == false) return redirect("/waiting-room");
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<RealtimeProvider
|
<RealtimeProvider
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ export default function Register() {
|
|||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
localStorage.removeItem("hipmi_auth_code_id");
|
localStorage.removeItem("hipmi_auth_code_id");
|
||||||
ComponentGlobal_NotifikasiBerhasil(result.message);
|
ComponentGlobal_NotifikasiBerhasil(result.message);
|
||||||
router.push("/waiting-room", { scroll: false });
|
router.push("/dev/home", { scroll: false });
|
||||||
|
|
||||||
await auth_funDeleteAktivasiKodeOtpByNomor({
|
await auth_funDeleteAktivasiKodeOtpByNomor({
|
||||||
nomor: data.nomor,
|
nomor: data.nomor,
|
||||||
|
|||||||
@@ -103,13 +103,13 @@ export default function Validasi() {
|
|||||||
localStorage.removeItem("hipmi_auth_code_id");
|
localStorage.removeItem("hipmi_auth_code_id");
|
||||||
|
|
||||||
if (result.roleId === "1") {
|
if (result.roleId === "1") {
|
||||||
if (result.active === true) {
|
ComponentGlobal_NotifikasiBerhasil(result.message);
|
||||||
ComponentGlobal_NotifikasiBerhasil(result.message);
|
router.push(RouterHome.main_home, { scroll: false });
|
||||||
router.push(RouterHome.main_home, { scroll: false });
|
// if (result.active === true) {
|
||||||
} else {
|
// } else {
|
||||||
ComponentGlobal_NotifikasiBerhasil(result.message);
|
// ComponentGlobal_NotifikasiBerhasil(result.message);
|
||||||
router.push("/waiting-room", { scroll: false });
|
// router.push("/waiting-room", { scroll: false });
|
||||||
}
|
// }
|
||||||
} else {
|
} else {
|
||||||
ComponentGlobal_NotifikasiBerhasil("Admin Logged in");
|
ComponentGlobal_NotifikasiBerhasil("Admin Logged in");
|
||||||
router.push(RouterAdminDashboard.splash_admin, { scroll: false });
|
router.push(RouterAdminDashboard.splash_admin, { scroll: false });
|
||||||
|
|||||||
@@ -32,13 +32,13 @@ export default function HomeView({
|
|||||||
const [countLoadNtf, setCountLoadNtf] = useAtom(gs_count_ntf);
|
const [countLoadNtf, setCountLoadNtf] = useAtom(gs_count_ntf);
|
||||||
const userRoleId = dataUser.masterUserRoleId;
|
const userRoleId = dataUser.masterUserRoleId;
|
||||||
|
|
||||||
useShallowEffect(() => {
|
// useShallowEffect(() => {
|
||||||
if (userRoleId === "2" || userRoleId === "3") {
|
// if (userRoleId === "2" || userRoleId === "3") {
|
||||||
setTimeout(() => {
|
// setTimeout(() => {
|
||||||
router.push("/waiting-room", { scroll: false });
|
// router.push("/waiting-room", { scroll: false });
|
||||||
}, 1000);
|
// }, 1000);
|
||||||
}
|
// }
|
||||||
}, [userRoleId]);
|
// }, [userRoleId]);
|
||||||
|
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
onLoadNotifikasi({
|
onLoadNotifikasi({
|
||||||
|
|||||||
Reference in New Issue
Block a user