diff --git a/functions/api/coconut.ts b/functions/api/coconut.ts index dfc7d81..086d6b5 100644 --- a/functions/api/coconut.ts +++ b/functions/api/coconut.ts @@ -10,15 +10,14 @@ export async function onRequestPost(context: RequestContext) { return jsonError("Invalid report id or token", 400); const id = attachment.replace(/\.mp4$/, ""); - const coconutData: { token: string } | null = await context.env.DATA.get( + const coconutToken: string | null = await context.env.DATA.get( `coconutjob_${id}`, - { type: "json" }, ); - if (!coconutData) + if (!coconutToken) return jsonError("Request is stale or otherwise invalid", 400); - if (coconutData.token !== token) return jsonError("Forbidden", 403); + if (coconutToken !== token) return jsonError("Forbidden", 403); await context.env.DATA.delete(`coconutjob_${id}`);