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