diff --git a/app/routes/hammer.tsx b/app/routes/hammer.tsx index 107243f..c32af97 100644 --- a/app/routes/hammer.tsx +++ b/app/routes/hammer.tsx @@ -10,15 +10,29 @@ import { Input, Stack, StackDivider, - Text, + Text } from "@chakra-ui/react"; import { type FormEvent, useState } from "react"; +export async function loader({ context }: { context: RequestContext }) { + const { current_user: currentUser } = context.data; + + if (!currentUser) + throw new Response(null, { + status: 401 + }); + + if (!(currentUser & 1 << 5)) + throw new Response(null, { + status: 403 + }); +} + export function meta() { return [{ title: "Hammer - Car Crushers" }]; } -export default function () { +export default function() { const [username, setUsername] = useState(""); const [uid, setUid] = useState(""); const [status, setStatus] = useState("");