Skip to content

Commit

Permalink
backend: api: private_notes: fix async-await and catch error
Browse files Browse the repository at this point in the history
  • Loading branch information
ericswpark committed Apr 21, 2024
1 parent bc9b7c5 commit 5036234
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions backend/src/app/api/v0/private_notes/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,16 @@ export async function POST(request: NextRequest) {

if (db_query.total == 0) {
// Create new object
createPrivateNote({
database,
user_id,
book_id,
notes,
});
try {
await createPrivateNote({
database,
user_id,
book_id,
notes,
});
} catch (error) {
return handle_error(error);
}
} else {
const private_note_id = db_query.documents[0].$id;

Expand Down

0 comments on commit 5036234

Please sign in to comment.