import api from "@/lib/api"; import type { LoginResponse, RegisterPayload, TwoFactorSetupResponse, } from "@/types/auth"; export const AuthService = { async login(email: string, password: string): Promise { const { data } = await api.post("/auth/login", { email, password, }); return data; }, async verify2fa(userId: string, token: string): Promise { const { data } = await api.post("/auth/verify-2fa", { userId, token, }); return data; }, async register(payload: RegisterPayload): Promise { await api.post("/auth/register", payload); }, async logout(): Promise { await api.post("/auth/logout"); }, async refresh(): Promise { await api.post("/auth/refresh"); }, async setup2fa(): Promise { const { data } = await api.post( "/users/me/2fa/setup", ); return data; }, async enable2fa(token: string): Promise { await api.post("/users/me/2fa/enable", { token }); }, async disable2fa(token: string): Promise { await api.post("/users/me/2fa/disable", { token }); }, };