Skip to content

Commit d1849b0

Browse files
committed
Adding admin config endpoint (temp)
1 parent 3aa634d commit d1849b0

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)