From eff1715cb2366ca8643381cf61b8fb2f83933625 Mon Sep 17 00:00:00 2001 From: WidaSuryani Date: Wed, 19 Jun 2024 23:03:21 +0800 Subject: [PATCH 1/2] fix : fixed bug Signing out doesn't redirect out of the app --- hosting/src/app/(protected)/layout.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hosting/src/app/(protected)/layout.tsx b/hosting/src/app/(protected)/layout.tsx index 8e04bd01..5992b581 100644 --- a/hosting/src/app/(protected)/layout.tsx +++ b/hosting/src/app/(protected)/layout.tsx @@ -2,11 +2,19 @@ import CmsLayout from "@/components/Layouts/CmsLayout"; import React from "react"; +import {useAuthentication} from "@/hooks/useAuthentication"; +import {redirect} from "next/navigation"; interface ProtectedLayoutProps { children: React.ReactNode; } export default function ProtectedLayout({children}: ProtectedLayoutProps) { + const {isSignedIn} = useAuthentication(); + + if (isSignedIn === false) { + redirect("/auth"); + } + return {children}; } From 03f54385681bb11d8553dbb9f7bbab71689e357b Mon Sep 17 00:00:00 2001 From: WidaSuryani Date: Thu, 20 Jun 2024 08:41:00 +0800 Subject: [PATCH 2/2] fix : change redirect --- hosting/src/app/(protected)/layout.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hosting/src/app/(protected)/layout.tsx b/hosting/src/app/(protected)/layout.tsx index 5992b581..56371805 100644 --- a/hosting/src/app/(protected)/layout.tsx +++ b/hosting/src/app/(protected)/layout.tsx @@ -13,7 +13,7 @@ export default function ProtectedLayout({children}: ProtectedLayoutProps) { const {isSignedIn} = useAuthentication(); if (isSignedIn === false) { - redirect("/auth"); + redirect("/"); } return {children};