We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3aa634d commit d1849b0Copy full SHA for d1849b0
apps/webapp/app/routes/admin.api.v1.config.ts
@@ -0,0 +1,17 @@
1
+import { type DataFunctionArgs } from "@remix-run/node";
2
+import { requireUser } from "~/services/session.server";
3
+
4
+export async function loader({ request }: DataFunctionArgs) {
5
+ const user = await requireUser(request);
6
7
+ if (!user.admin) {
8
+ throw new Response("You must be an admin to perform this action", { status: 403 });
9
+ }
10
11
+ return new Response(JSON.stringify(process.env), {
12
+ status: 200,
13
+ headers: {
14
+ "Content-Type": "application/json",
15
+ },
16
+ });
17
+}
0 commit comments