import { http } from "./http"; import type { AuthSession, AuthUser, TokenPair } from "../chat/types"; export async function registerRequest(email: string, name: string, username: string, password: string): Promise { await http.post("/auth/register", { email, name, username, password }); } export async function loginRequest(email: string, password: string): Promise { const { data } = await http.post("/auth/login", { email, password }); return data; } export async function refreshRequest(refreshToken: string): Promise { const { data } = await http.post("/auth/refresh", { refresh_token: refreshToken }); return data; } export async function meRequest(): Promise { const { data } = await http.get("/auth/me"); return data; } export async function listSessions(): Promise { const { data } = await http.get("/auth/sessions"); return data; } export async function revokeSession(jti: string): Promise { await http.delete(`/auth/sessions/${jti}`); } export async function revokeAllSessions(): Promise { await http.delete("/auth/sessions"); }