Finish delete endpoint
This commit is contained in:
@@ -52,7 +52,9 @@ app.delete('/berrydash/profile/posts', context =>
|
|||||||
app.all('*', () =>
|
app.all('*', () =>
|
||||||
jsonResponse(
|
jsonResponse(
|
||||||
{
|
{
|
||||||
message: 'No endpoint found (are you using the correct request method?)'
|
success: false,
|
||||||
|
message: 'No endpoint found (are you using the correct request method?)',
|
||||||
|
data: null
|
||||||
},
|
},
|
||||||
404
|
404
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -43,9 +43,9 @@ export async function handler (context: Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const userData = await db1
|
const userData = await db1
|
||||||
.select({ id: users.id })
|
.select({ id: berryDashUserData.id })
|
||||||
.from(berryDashUserData)
|
.from(berryDashUserData)
|
||||||
.where(eq(berryDashUserData.token, authorizationToken as string))
|
.where(eq(berryDashUserData.token, authorizationToken))
|
||||||
.execute()
|
.execute()
|
||||||
|
|
||||||
if (!userData[0]) {
|
if (!userData[0]) {
|
||||||
@@ -73,7 +73,6 @@ export async function handler (context: Context) {
|
|||||||
connection1.end()
|
connection1.end()
|
||||||
|
|
||||||
if (result[0])
|
if (result[0])
|
||||||
return jsonResponse({ success: true, message: 'Success', data: null }, 200)
|
return jsonResponse({ success: true, message: null, data: null }, 200)
|
||||||
else
|
else return jsonResponse({ success: false, message: null, data: null }, 400)
|
||||||
return jsonResponse({ success: false, message: 'Failed', data: null }, 400)
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user