Fix: Cookies
This commit is contained in:
@@ -1,9 +1,15 @@
|
||||
import { Login } from "@/app_modules/auth";
|
||||
import versionUpdate from "../../../../../package.json";
|
||||
import { funCheckCookies } from "@/app_modules/_global/fun/get/fun_check_cookies";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
export default async function Page() {
|
||||
const version = versionUpdate.version;
|
||||
|
||||
const checkCookies = await funCheckCookies();
|
||||
console.log(checkCookies, "ini halaman login");
|
||||
if (!checkCookies) return redirect("/");
|
||||
|
||||
return (
|
||||
<>
|
||||
<Login version={version} />
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { SplashScreen } from "@/app_modules/auth";
|
||||
|
||||
export default async function PageSplash() {
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
return (
|
||||
<>
|
||||
<SplashScreen userLoginId={userLoginId} />
|
||||
<SplashScreen checkCookies/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import { Validasi } from "@/app_modules/auth";
|
||||
import { auth_getCodeOtpByNumber } from "@/app_modules/auth/fun/get_kode_otp_by_id";
|
||||
import { redirect } from "next/navigation";
|
||||
import { RouterAuth } from "@/app/lib/router_hipmi/router_auth";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
let kodeId = params.id;
|
||||
const dataOtp = await auth_getCodeOtpByNumber({ kodeId: kodeId });
|
||||
// if (dataOtp === null) return redirect(RouterAuth.login);
|
||||
|
||||
|
||||
return <Validasi dataOtp={dataOtp as any} />;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,21 @@
|
||||
import { RouterAdminDashboard } from "@/app/lib/router_hipmi/router_admin";
|
||||
import { RouterHome } from "@/app/lib/router_hipmi/router_home";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { funGlobal_getUserById } from "@/app_modules/_global/fun/get/fun_get_user_by_id";
|
||||
import { CheckCookies_UiView } from "@/app_modules/check_cookies";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
export default function Page() {
|
||||
return <CheckCookies_UiView />;
|
||||
export default async function Page() {
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
const dataUser = await funGlobal_getUserById({ userId: userLoginId });
|
||||
|
||||
if (dataUser?.masterUserRoleId === "1") {
|
||||
return redirect(RouterHome.main_home);
|
||||
}
|
||||
|
||||
if (dataUser?.masterUserRoleId !== "1") {
|
||||
return redirect(RouterAdminDashboard.splash_admin);
|
||||
}
|
||||
|
||||
// return <CheckCookies_UiView />;
|
||||
}
|
||||
|
||||
@@ -1,27 +1,24 @@
|
||||
import { RouterAdminDashboard } from "@/app/lib/router_hipmi/router_admin";
|
||||
import { RouterHome } from "@/app/lib/router_hipmi/router_home";
|
||||
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 Page() {
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const dataUser = await user_getOneByUserId(userLoginId as string);
|
||||
const dataJob = await job_getTwoForHomeView();
|
||||
|
||||
if (dataUser?.active === false) {
|
||||
return redirect(RouterHome.home_user_non_active);
|
||||
}
|
||||
|
||||
if (dataUser?.masterUserRoleId === "2" || dataUser?.masterUserRoleId === "3")
|
||||
return redirect(RouterAdminDashboard.splash_admin);
|
||||
|
||||
const countNotifikasi = await notifikasi_countUserNotifikasi();
|
||||
|
||||
// console.log(userLoginId, "ini di home");
|
||||
// console.log(dataUser, "ini di home");
|
||||
|
||||
// if (dataUser?.active === false) {
|
||||
// return redirect(RouterHome.home_user_non_active);
|
||||
// }
|
||||
// if (dataUser?.masterUserRoleId === "2" || dataUser?.masterUserRoleId === "3")
|
||||
// return redirect(RouterAdminDashboard.splash_admin);
|
||||
|
||||
return (
|
||||
<>
|
||||
<HomeView
|
||||
|
||||
@@ -1,11 +1,38 @@
|
||||
"use client";
|
||||
import { CheckCookies_UiLayout } from "@/app_modules/check_cookies";
|
||||
import { RealtimeProvider } from "../lib";
|
||||
import { funCheckCookies } from "@/app_modules/_global/fun/get/fun_check_cookies";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { ServerEnv } from "../lib/server_env";
|
||||
import { funGlobal_getUserById } from "@/app_modules/_global/fun/get/fun_get_user_by_id";
|
||||
import { RouterHome } from "../lib/router_hipmi/router_home";
|
||||
import { RouterAdminDashboard } from "../lib/router_hipmi/router_admin";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
export default async function Layout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const checkCookies = await funCheckCookies();
|
||||
if (!checkCookies) return redirect("/");
|
||||
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
const WIBU_REALTIME_TOKEN = process.env.NEXT_PUBLIC_WIBU_REALTIME_TOKEN;
|
||||
// console.log(WIBU_REALTIME_TOKEN, "check cookies di layout dalam");
|
||||
|
||||
export default function Layout({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<>
|
||||
<RealtimeProvider
|
||||
userLoginId={userLoginId as string}
|
||||
WIBU_REALTIME_TOKEN={
|
||||
ServerEnv.value?.NEXT_PUBLIC_WIBU_REALTIME_TOKEN as string
|
||||
}
|
||||
/>
|
||||
|
||||
{children}
|
||||
{/* <CheckCookies_UiLayout>{children}</CheckCookies_UiLayout> */}
|
||||
{/* <CheckCookies_UiLayout dataUser={dataUser as any}>
|
||||
{children}
|
||||
</CheckCookies_UiLayout> */}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,16 +2,16 @@ import { RouterHome } from "@/app/lib/router_hipmi/router_home";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { Home_UserNonActive } from "@/app_modules/home";
|
||||
import { user_getOneByUserId } from "@/app_modules/home/fun/get/get_one_user_by_id";
|
||||
import { redirect } from "next/navigation";
|
||||
// import { redirect } from "next/navigation";
|
||||
|
||||
export default async function Page() {
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const dataUser = await user_getOneByUserId(userLoginId as string);
|
||||
|
||||
if (dataUser?.active === true) {
|
||||
return redirect(RouterHome.main_home);
|
||||
}
|
||||
// if (dataUser?.active === true) {
|
||||
// return redirect(RouterHome.main_home);
|
||||
// }
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { CheckCookies_UiView } from "@/app_modules/check_cookies";
|
||||
import { LayoutVote_DetailSemuaRiwayat } from "@/app_modules/vote";
|
||||
import React from "react";
|
||||
|
||||
@@ -12,9 +11,7 @@ export default async function Layout({
|
||||
}) {
|
||||
const votingId = params.id;
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
if (!userLoginId) return <CheckCookies_UiView />;
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<LayoutVote_DetailSemuaRiwayat
|
||||
|
||||
Reference in New Issue
Block a user