From eadddeede5b24af8a3492a13eefae42f3b38c53e Mon Sep 17 00:00:00 2001 From: seanquiambao Date: Mon, 30 Sep 2024 17:30:33 -0700 Subject: [PATCH] removed comments and console logs --- src/components/ProtectedPage.jsx | 54 -------------------------------- 1 file changed, 54 deletions(-) diff --git a/src/components/ProtectedPage.jsx b/src/components/ProtectedPage.jsx index f19de00fa..7fcfefeb9 100644 --- a/src/components/ProtectedPage.jsx +++ b/src/components/ProtectedPage.jsx @@ -26,7 +26,6 @@ const ProtectedPage = async ({ children, restrictions, title }) => { throw new Fault(403, "Unauthorized", "You do not have any assigned roles"); } - console.log("session:", session.user.roles); const authorized = Object.entries(restrictions).some(([key, values]) => Array.isArray(values) ? values.includes(session.user.roles[key]) @@ -51,56 +50,3 @@ const ProtectedPage = async ({ children, restrictions, title }) => { }; export default ProtectedPage; - -// delete later -// useEffect(() => { -// if (RELEASES[pathName] > new Date()) { -// throw new Fault( -// 423, -// "Locked Resource", -// "This resource has not been released", -// ); -// } - -// if (status === "loading") return; -// if (status !== "authenticated") { -// void signIn("google"); -// return; -// } - -// if (!session.user.roles && Object.keys(restrictions).length > 0) { -// throw new Fault( -// 403, -// "Unauthorized", -// "You do not have any assigned roles", -// ); -// } - -// const authorized = Object.entries(restrictions).some(([key, values]) => -// Array.isArray(values) -// ? values.includes(session.user.roles[key]) -// : session.user.roles[key] === values, -// ); - -// if (!authorized && Object.keys(restrictions).length > 0) { -// throw new Fault(403, "Unauthorized", "You do not have access this page"); -// } -// setConfirmed(true); -// }, [status]); - -// const navigation = RegExp(/user\/|admin\//).test(pathName); - -// return ( -// <> -// {status === "loading" && } -// {confirmed && ( -// <> -// {title} -// {navigation && } -//
-//
{children}
-//
-// -// )} -// -// );