Skip to content

Commit

Permalink
feat: Improve error handling and remove unnecessary console logs in f…
Browse files Browse the repository at this point in the history
…riends request handler
  • Loading branch information
tako0614 committed Jun 16, 2024
1 parent a66c822 commit a421e24
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions routes/api/v1/server/friends/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const handler = {
if (
userDomain == env["serverDomain"] || friendDomain == userDomain
) {
console.log("userDomain" + userDomain)
return new Response(JSON.stringify({ status: false }), {
status: 400,
})
Expand All @@ -49,12 +50,14 @@ export const handler = {
`${userDomain}/api/v1/server/token?token=` + token + "&origin=" + env["serverDomain"],
)
if (!isTrueToken) {
console.log("isTrueToken")
return new Response(JSON.stringify({ status: false }), {
status: 400,
})
}
const isTrueTokenJson = await isTrueToken.json()
if (isTrueTokenJson.status !== true) {
console.log("isTrueToken")
return new Response(JSON.stringify({ status: false }), {
status: 400,
})
Expand All @@ -65,6 +68,7 @@ export const handler = {
"friends.userid": recipientUserName,
})
if (!existingFriend) {
console.log("existingFriend")
return new Response(
JSON.stringify({
status: false,
Expand Down

0 comments on commit a421e24

Please sign in to comment.