Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.
TypeScript analyticsaudience-segmentationchartscohort-analysisgoogle-analyticsproduct-analyticsstatisticsuser-journeyweb-analytics
Updated `/api/batch` to return `cache`
RaenonXc86ea1a74f4b
diff --git a/src/app/api/batch/route.ts b/src/app/api/batch/route.tsindex aae14c96e..46e8b3c33 100644--- a/src/app/api/batch/route.ts+++ b/src/app/api/batch/route.ts@@ -17,6 +17,7 @@ export async function POST(request: Request) {const errors = [];let index = 0;+ let cache = null;for (const data of body) {// Recreate a fresh Request since `new Request(request)` will have the following error:// > Cannot read private member #state from an object whose class did not declare it@@ -33,9 +34,12 @@ export async function POST(request: Request) {});const response = await send.POST(newRequest);+ const responseJson = await response.json();if (!response.ok) {- errors.push({ index, response: await response.json() });+ errors.push({ index, response: responseJson });+ } else {+ cache ??= responseJson.cache;}index++;@@ -46,6 +50,7 @@ export async function POST(request: Request) {processed: body.length - errors.length,errors: errors.length,details: errors,+ cache,});} catch (e) {return serverError(e);