fix: old code

This commit is contained in:
TrèsAbhi committed 2024-05-01 20:56:38 -05:00
1 parent c24639dd0c
commit 99ed269723
6 files changed
+1 -272

No files matched your search

+1 -1
View File
@@ -13,7 +13,7 @@ const fonts = [
export default async function jsxToSvg(
jsx: JSX.Element,
renderConfiguration: RenderConfiguration,
renderConfiguration = new RenderConfiguration(),
) {
return await satori(jsx, {
width: renderConfiguration.width,
-8
View File
@@ -1,8 +0,0 @@
import { useSession } from '../../stores/session';
import { setSession } from './setSession';
export function resetSession() {
const session = useSession.getState();
if (!session.isTracking) return;
setSession(session.region, session.id, session.nickname);
}
-27
View File
@@ -1,27 +0,0 @@
import { Region } from '../../constants/regions';
import { useSession } from '../../stores/session';
import { NormalizedTankStats, TanksStats } from '../../types/tanksStats';
import fetchBlitz from '../blitz/fetchBlitz';
export async function setSession(region: Region, id: number, nickname: string) {
// TODO: generalize this function and also check for more of these kind
const rawTankStats = (
await fetchBlitz<TanksStats>(region, 'tanks/stats', { account_id: id })
)[id];
const tankStats = rawTankStats!.reduce<NormalizedTankStats>(
(accumulator, tank) => ({
...accumulator,
[tank.tank_id]: tank,
}),
{},
);
useSession.setState({
isTracking: true,
id,
region,
nickname,
tankStats,
time: Date.now(),
});
}