Make complete endpoint actually work
This commit is contained in:
parent
5f9dfb76e7
commit
bdeb84d6bc
@ -26,14 +26,17 @@ export async function onRequestPost(context: RequestContext) {
|
|||||||
|
|
||||||
await context.env.DATA.delete(`reportprocessing_${id}`);
|
await context.env.DATA.delete(`reportprocessing_${id}`);
|
||||||
|
|
||||||
const {
|
const value = await context.env.DATA.get(`report_${id}`);
|
||||||
metadata,
|
|
||||||
value,
|
|
||||||
}: KVNamespaceGetWithMetadataResult<string, { [k: string]: any }> =
|
|
||||||
await context.env.DATA.getWithMetadata(`report_${id}`);
|
|
||||||
|
|
||||||
delete metadata?.p;
|
if (!value)
|
||||||
await context.env.DATA.put(`report_${id}`, value as string, { metadata });
|
return new Response('{"error":"Report is missing"}', {
|
||||||
|
headers: {
|
||||||
|
"content-type": "application/json",
|
||||||
|
},
|
||||||
|
status: 500,
|
||||||
|
});
|
||||||
|
|
||||||
|
await context.env.DATA.put(`report_${id}`, value as string);
|
||||||
|
|
||||||
if (context.env.REPORTS_WEBHOOK) {
|
if (context.env.REPORTS_WEBHOOK) {
|
||||||
await fetch(context.env.REPORTS_WEBHOOK, {
|
await fetch(context.env.REPORTS_WEBHOOK, {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user