import { fetchWithAuth } from "./client"; export const authApi = { register: (data: { name: string; email: string; password: string }) => fetchWithAuth("/api/v1/auth/register", { method: "POST", body: JSON.stringify(data), }), login: (data: { email: string; password: string }) => fetchWithAuth("/api/v1/auth/login", { method: "POST", body: JSON.stringify(data), }), getMe: (token: string) => fetchWithAuth("/api/v1/auth/me", {}, token), forgotPassword: (email: string) => fetchWithAuth("/api/v1/auth/forgot-password", { method: "POST", body: JSON.stringify({ email }), }), resetPassword: (token: string, newPassword: string) => fetchWithAuth("/api/v1/auth/reset-password", { method: "POST", body: JSON.stringify({ token, new_password: newPassword }), }), verifyEmail: (email: string, code: string) => fetchWithAuth("/api/v1/auth/verify-email", { method: "POST", body: JSON.stringify({ email, code }), }), resendVerification: (email: string) => fetchWithAuth("/api/v1/auth/resend-verification", { method: "POST", body: JSON.stringify({ email }), }), changePassword: (token: string, oldPassword: string, newPassword: string) => fetchWithAuth( "/api/v1/auth/change-password", { method: "PUT", body: JSON.stringify({ old_password: oldPassword, new_password: newPassword, }), }, token ), updateProfile: ( token: string, data: { name?: string; avatar_url?: string } ) => fetchWithAuth( "/api/v1/auth/profile", { method: "PUT", body: JSON.stringify(data), }, token ), };