Add missing auth check to hammer page
This commit is contained in:
parent
b0ec692777
commit
02c16c7168
@ -10,10 +10,24 @@ import {
|
|||||||
Input,
|
Input,
|
||||||
Stack,
|
Stack,
|
||||||
StackDivider,
|
StackDivider,
|
||||||
Text,
|
Text
|
||||||
} from "@chakra-ui/react";
|
} from "@chakra-ui/react";
|
||||||
import { type FormEvent, useState } from "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() {
|
export function meta() {
|
||||||
return [{ title: "Hammer - Car Crushers" }];
|
return [{ title: "Hammer - Car Crushers" }];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user