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