mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-22 03:07:04 +02:00
feat: session persistance
This commit is contained in:
1 parent
57f6e928b7
commit
018783bb47
12 files changed
+121
-29
No files matched your search
File renamed without changes.
@@ -0,0 +1,16 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { Region } from '../../../../../constants/regions';
|
||||
import getTankStats from '../../../../../core/blitz/getTankStats';
|
||||
import { NormalizedTankStats } from '../../../../../types/tanksStats';
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
const region = request.nextUrl.searchParams.get('region') as Region;
|
||||
const id = parseInt(request.nextUrl.searchParams.get('id')!);
|
||||
const tankStats = await getTankStats(region, id);
|
||||
const normalized = tankStats.reduce<NormalizedTankStats>(
|
||||
(accumulator, tank) => ({ ...accumulator, [tank.tank_id]: tank }),
|
||||
{},
|
||||
);
|
||||
|
||||
return NextResponse.json(normalized);
|
||||
}
|
||||
Reference in new issue
Block a user