import type { ApiClient } from './api';

export interface User {
	email: string;
}

export async function validateToken(api: ApiClient): Promise<User | null> {
	try {
		const response = await api.get('/access/me');

		if (!response.ok) return null;

		return await response.json();
	} catch (error) {
		console.error('Token validation failed:', error);
		return null;
	}
}
