import { apiFetch } from "./http"; import type { MessageResponse, RegisterResponse, TokenResponse, UserCreate, UserLogin, } from "./types"; export async function register(body: UserCreate): Promise { return apiFetch("/auth/register", { method: "POST", body: JSON.stringify(body), skipAuth: true, }); } export async function login(body: UserLogin): Promise { return apiFetch("/auth/login", { method: "POST", body: JSON.stringify(body), skipAuth: true, }); } export async function refresh(refreshToken: string): Promise { return apiFetch("/auth/refresh", { method: "POST", body: JSON.stringify({ refresh_token: refreshToken }), skipAuth: true, }); } export async function logout(refreshToken: string): Promise { return apiFetch("/auth/logout", { method: "POST", body: JSON.stringify({ refresh_token: refreshToken }), }); } export async function forgotPassword(email: string): Promise { return apiFetch("/auth/forgot-password", { method: "POST", body: JSON.stringify({ email }), skipAuth: true, }); } export async function resetPassword(token: string, password: string): Promise { return apiFetch("/auth/reset-password", { method: "POST", body: JSON.stringify({ token, password }), skipAuth: true, }); } export async function verifyEmail(token: string): Promise { return apiFetch("/auth/verify-email", { method: "POST", body: JSON.stringify({ token }), skipAuth: true, }); }