Adding admin config endpoint (temp)

This commit is contained in:
Eric Allam
2024-04-11 10:30:45 +01:00
parent 3aa634d2b8
commit d1849b0ea9
@@ -0,0 +1,17 @@
import { type DataFunctionArgs } from "@remix-run/node";
import { requireUser } from "~/services/session.server";
export async function loader({ request }: DataFunctionArgs) {
const user = await requireUser(request);
if (!user.admin) {
throw new Response("You must be an admin to perform this action", { status: 403 });
}
return new Response(JSON.stringify(process.env), {
status: 200,
headers: {
"Content-Type": "application/json",
},
});
}