Skip to content

Commit

Permalink
fix: burn notes api response missing
Browse files Browse the repository at this point in the history
  • Loading branch information
scolastico committed Nov 6, 2024
1 parent a2b15e2 commit 67f550e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions server/api/json/[id]/[key].get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ export default defineEventHandler(async (event) => {
return {
success: true,
content: CryptoJS.AES.decrypt(note.content, key).toString(CryptoJS.enc.Utf8),
expires: note.burn_after_reading ? Math.floor(new Date() / 1000) : note.expires_at,
expires: note.burn_after_reading ? Math.floor(+new Date() / 1000) : note.expires_at,
burnt: note.burn_after_reading,
}
} catch (e) {
setResponseStatus(event, 400);
return {success: false, error: 'Invalid key', burn: note.burnAfterReading};
return {success: false, error: 'Invalid key', burnt: note.burn_after_reading};
}
})
2 changes: 1 addition & 1 deletion server/api/json/[id]/index.get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default defineEventHandler(async (event) => {
return {
success: true,
content: note.content,
expires: note.burn_after_reading ? Math.floor(new Date() / 1000) : note.expires_at,
expires: note.burn_after_reading ? Math.floor(+new Date() / 1000) : note.expires_at,
burnt: note.burn_after_reading,
}
})

0 comments on commit 67f550e

Please sign in to comment.