Make it so you can use the icon marketplace while not logged in
This commit is contained in:
@@ -53,15 +53,10 @@ export async function handler (context: Context) {
|
|||||||
db0,
|
db0,
|
||||||
ip
|
ip
|
||||||
)
|
)
|
||||||
if (!authResult.valid) {
|
let userId: number | null = null
|
||||||
connection0.end()
|
if (authResult.valid) {
|
||||||
connection1.end()
|
userId = authResult.id
|
||||||
return jsonResponse(
|
|
||||||
{ success: false, message: 'Unauthorized', data: null },
|
|
||||||
401
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
const userId = authResult.id
|
|
||||||
|
|
||||||
const body: { [key: string]: any } = context.body as any
|
const body: { [key: string]: any } = context.body as any
|
||||||
|
|
||||||
@@ -109,9 +104,9 @@ export async function handler (context: Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (body3.onlyShowEnabled) {
|
if (body3.onlyShowEnabled) {
|
||||||
if (body3.onlyShowValue === 0) {
|
if (body3.onlyShowValue === 0 && userId) {
|
||||||
filters.push(eq(berryDashMarketplaceIcons.userId, userId))
|
filters.push(eq(berryDashMarketplaceIcons.userId, userId))
|
||||||
} else if (body3.onlyShowValue === 1) {
|
} else if (body3.onlyShowValue === 1 && userId) {
|
||||||
filters.push(sql`${berryDashMarketplaceIcons.userId} != ${userId}`)
|
filters.push(sql`${berryDashMarketplaceIcons.userId} != ${userId}`)
|
||||||
} else if (body3.onlyShowValue === 2) {
|
} else if (body3.onlyShowValue === 2) {
|
||||||
filters.push(inArray(berryDashMarketplaceIcons.uuid, body3.currentIcons))
|
filters.push(inArray(berryDashMarketplaceIcons.uuid, body3.currentIcons))
|
||||||
|
|||||||
Reference in New Issue
Block a user