Ir para o conteúdo principal
kitlocal.dev

Visualizador de Git Diff

Roda localmente

100% processado no seu navegador. Entradas e saídas nunca saem do seu dispositivo.

Visualizador de Git diff com destaque de sintaxe e comparação lado a lado.

Contexto

Código Original

Código Modificado

Diff Linha por Linha

+8 adicionadas-4 removidas
1import { readCache, writeCache } from './cache';1import { deleteCache, readCache, writeCache } from './cache';
22
3export interface UserSession {3export interface UserSession {
4 id: string;4 id: string;
5 role: 'viewer' | 'editor';5 role: 'viewer' | 'editor' | 'admin';
6 expiresAt: number;6 expiresAt: number;
7 issuedAt: number;
7}8}
89
9export async function refreshSession(token: string): Promise<UserSession | null> {10export async function refreshSession(token: string): Promise<UserSession | null> {
10 if (!token) {11 const trimmed = token.trim();
12 if (!trimmed) {
11 return null;13 return null;
12 }14 }
13 const cached = await readCache(token);15 const cached = await readCache(trimmed);
14 if (cached && cached.expiresAt > Date.now()) {16 if (cached && cached.expiresAt > Date.now()) {
17 await writeCache(trimmed, cached);
15 return cached;18 return cached;
16 }19 }
20 await deleteCache(trimmed);
17 return null;21 return null;
18}22}