add note cache headers
This commit is contained in:
parent
9b4eccd2a7
commit
f78de8ab3d
Binary file not shown.
@ -1,7 +1,7 @@
|
||||
export type EncryptedNote = {
|
||||
id: string;
|
||||
insert_time: Date;
|
||||
expiry_time: Date;
|
||||
expire_time: Date;
|
||||
ciphertext: string;
|
||||
hmac: string;
|
||||
};
|
||||
|
@ -10,9 +10,14 @@
|
||||
try {
|
||||
const note: EncryptedNote = await response.json();
|
||||
note.insert_time = new Date(note.insert_time as unknown as string);
|
||||
note.expiry_time = new Date(note.expiry_time as unknown as string);
|
||||
note.expire_time = new Date(note.expire_time as unknown as string);
|
||||
const maxage = Math.floor((note.expire_time.valueOf() - note.insert_time.valueOf()) / 1000);
|
||||
return {
|
||||
status: response.status,
|
||||
cache: {
|
||||
maxage: maxage,
|
||||
private: false
|
||||
},
|
||||
props: { note }
|
||||
};
|
||||
} catch {
|
||||
|
Loading…
Reference in New Issue
Block a user