mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-30 07:12:36 -05:00
Timed bans feature
This commit is contained in:
16
app/features/admin/loaders/admin.server.ts
Normal file
16
app/features/admin/loaders/admin.server.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import type { LoaderFunction } from "@remix-run/node";
|
||||
import { redirect } from "@remix-run/node";
|
||||
import { getUserId, isImpersonating } from "~/features/auth/core/user.server";
|
||||
import { isMod } from "~/permissions";
|
||||
|
||||
export const loader: LoaderFunction = async ({ request }) => {
|
||||
const user = await getUserId(request);
|
||||
|
||||
if (process.env.NODE_ENV === "production" && !isMod(user)) {
|
||||
throw redirect("/");
|
||||
}
|
||||
|
||||
return {
|
||||
isImpersonating: await isImpersonating(request),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user