import { api, tokenStorage } from './client' import type { User } from './types' interface TokenPair { access: string refresh: string } export async function login(email: string, password: string): Promise { const tokens = await api.post('/api/auth/token/', { email, password }) tokenStorage.set(tokens.access, tokens.refresh) } export async function register(email: string, username: string, password: string): Promise { await api.post('/api/accounts/register/', { email, username, password }) await login(email, password) } export function logout(): void { tokenStorage.clear() } export function getMe(): Promise { return api.get('/api/accounts/me/') }