Move app to apps/web-react in pnpm workspace layout

This commit is contained in:
Kalle
2026-08-16 09:20:33 +03:00
parent 7e365ccfcf
commit bbc8ea57af
2913 changed files with 227 additions and 250 deletions

View File

@@ -0,0 +1,26 @@
import * as ApiRepository from "~/features/api/ApiRepository.server";
import type { ApiTokenType } from "~/features/api/api-types";
type CachedToken = { type: ApiTokenType; userId: number };
async function loadApiTokensCache() {
const dbTokens = await ApiRepository.findAllApiTokens();
const tokenMap = new Map<string, CachedToken>();
for (const { token, type, userId } of dbTokens) {
tokenMap.set(token, { type, userId });
}
return tokenMap;
}
let apiTokens: Map<string, CachedToken> = await loadApiTokensCache();
export function getTokenInfo(token: string): CachedToken | undefined {
return apiTokens.get(token);
}
export async function refreshApiTokensCache() {
apiTokens = await loadApiTokensCache();
}