Spaces:
Runtime error
Runtime error
remove token if needed
Browse files- app/api/me/route.ts +2 -0
app/api/me/route.ts
CHANGED
@@ -17,6 +17,8 @@ export async function GET() {
|
|
17 |
const HF_ADMIN = process?.env?.HF_ADMIN?.split(',') ?? []
|
18 |
const is_admin = res?.sub ? HF_ADMIN.includes(res?.sub) : false
|
19 |
|
|
|
|
|
20 |
return Response.json(
|
21 |
{
|
22 |
user: {
|
|
|
17 |
const HF_ADMIN = process?.env?.HF_ADMIN?.split(',') ?? []
|
18 |
const is_admin = res?.sub ? HF_ADMIN.includes(res?.sub) : false
|
19 |
|
20 |
+
if (!res?.sub) return Response.json({ status: 401, ok: false, message: "Unauthorized" });
|
21 |
+
|
22 |
return Response.json(
|
23 |
{
|
24 |
user: {
|