Authentication updates

This commit is contained in:
Jack Mechem 2026-03-28 16:01:45 -07:00
parent 98b1daa7d3
commit 3015c98246
15 changed files with 657 additions and 165 deletions

20
hooks/useCheckAuth.ts Normal file
View file

@ -0,0 +1,20 @@
import { useEffect } from "react";
import { useRouter } from "next/navigation";
export function useCheckAuth() {
const router = useRouter();
useEffect(() => {
async function check() {
const res = await fetch("/api/auth/check");
console.log(res);
if (!res.ok) {
console.log("Invalid tokin");
router.push(
"/auth?callbackUrl=" + encodeURIComponent(window.location.pathname),
);
}
}
check();
}, [router]);
}