first commit
This commit is contained in:
12
src/app/api/dashboard/timeseries/route.ts
Normal file
12
src/app/api/dashboard/timeseries/route.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import type {NextRequest} from 'next/server';
|
||||
import {ok, parseQuery, simulate, wantsEmpty} from '@/lib/api/server';
|
||||
import {buildTimeseries} from '@/lib/mock/dashboard';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
export async function GET(req: NextRequest) {
|
||||
const q = parseQuery(req);
|
||||
const simulated = await simulate(q);
|
||||
if (simulated) return simulated;
|
||||
return ok(wantsEmpty(q) ? [] : buildTimeseries(q.range, q.storeId, q.nowMs), q);
|
||||
}
|
||||
Reference in New Issue
Block a user