Updated login page, added ProtectedRoute object for wrapping in layouts, added ProtectedRoute authorization verification to Admin route root
This commit is contained in:
parent
f055e77eea
commit
efa42a53b2
5 changed files with 65 additions and 17 deletions
17
components/wrappers/ProtectedRoute.tsx
Normal file
17
components/wrappers/ProtectedRoute.tsx
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import React from "react";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
import { verifySession } from "@/lib/server_functions/dataAccessLayer";
|
||||
|
||||
export default async function ProtectedRoute({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const session = await verifySession();
|
||||
if (!session.isAuthed) {
|
||||
redirect("/Authentication/Login");
|
||||
}
|
||||
|
||||
return <div>{children}</div>;
|
||||
}
|
||||
Loading…
Reference in a new issue