Skip to content

Commit

Permalink
chore: Refactor friends request handler and improve error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
tako0614 committed Jun 16, 2024
1 parent d698541 commit a66c822
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions routes/api/v1/friends/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,16 @@ export const handler = {
},
)
}
if(friendInfo.uuid === userid){
console.log("friendInfo.uuid === userid")
return new Response(
JSON.stringify({ status: "error" }),
{
headers: { "Content-Type": "application/json" },
status: 400,
},
)
}
const myFriendInfo = await Friends.findOne({ user: userid })
if(!myFriendInfo){
await Friends.create({ user: userid })
Expand Down

0 comments on commit a66c822

Please sign in to comment.