feat: allow anonymous public wishlist viewing
This commit is contained in:
@@ -11,12 +11,6 @@ export async function GET(
|
||||
try {
|
||||
const { id } = await params;
|
||||
|
||||
const isAdmin = verifyAdminToken(request);
|
||||
const guest = await getGuestFromRequest(request);
|
||||
if (!isAdmin && !guest) {
|
||||
return NextResponse.json({ error: 'Convite necessário' }, { status: 401 });
|
||||
}
|
||||
|
||||
// Get item
|
||||
const item = await db
|
||||
.select()
|
||||
@@ -45,10 +39,13 @@ export async function GET(
|
||||
);
|
||||
}
|
||||
|
||||
if (!wishlist[0].isPublic && !isAdmin) {
|
||||
const isAdmin = verifyAdminToken(request);
|
||||
const guest = await getGuestFromRequest(request);
|
||||
|
||||
if (!wishlist[0].isPublic && !isAdmin && !guest) {
|
||||
return NextResponse.json(
|
||||
{ error: 'This item is private' },
|
||||
{ status: 403 }
|
||||
{ error: 'Convite necessário' },
|
||||
{ status: 401 }
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user