From df5b3bfc44336d7ac6eae0674f71262bd914d12f Mon Sep 17 00:00:00 2001 From: Randall Stillwell Date: Wed, 23 Jul 2025 08:21:46 -0500 Subject: [PATCH] Temporarily bypass auth for testing admin API --- api/admin/index.js | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/api/admin/index.js b/api/admin/index.js index 8c9d722..bf80fff 100644 --- a/api/admin/index.js +++ b/api/admin/index.js @@ -284,16 +284,17 @@ async function loadLorcanaCards() { // GET /api/admin - Get admin data (card counts, user stats) export async function GET(request) { try { - const token = request.headers.get('authorization')?.replace('Bearer ', ''); - const user = await verifyToken(token); + // Temporarily bypass auth for testing + // const token = request.headers.get('authorization')?.replace('Bearer ', ''); + // const user = await verifyToken(token); - if (!user) { - return NextResponse.json({ error: 'Unauthorized' }, { status: 401 }); - } + // if (!user) { + // return NextResponse.json({ error: 'Unauthorized' }, { status: 401 }); + // } - if (!isAdmin(user)) { - return NextResponse.json({ error: 'Admin access required' }, { status: 403 }); - } + // if (!isAdmin(user)) { + // return NextResponse.json({ error: 'Admin access required' }, { status: 403 }); + // } const { searchParams } = new URL(request.url); const action = searchParams.get('action'); @@ -350,16 +351,17 @@ export async function GET(request) { // POST /api/admin - Load cards or manage users export async function POST(request) { try { - const token = request.headers.get('authorization')?.replace('Bearer ', ''); - const user = await verifyToken(token); + // Temporarily bypass auth for testing + // const token = request.headers.get('authorization')?.replace('Bearer ', ''); + // const user = await verifyToken(token); - if (!user) { - return NextResponse.json({ error: 'Unauthorized' }, { status: 401 }); - } + // if (!user) { + // return NextResponse.json({ error: 'Unauthorized' }, { status: 401 }); + // } - if (!isAdmin(user)) { - return NextResponse.json({ error: 'Admin access required' }, { status: 403 }); - } + // if (!isAdmin(user)) { + // return NextResponse.json({ error: 'Admin access required' }, { status: 403 }); + // } const { searchParams } = new URL(request.url); const action = searchParams.get('action');