import { api, setToken, clearToken } from "@/lib/api-client"; import type { LoginRequest, LoginResponse, User, ResetPasswordRequest, CurrentUserResponse } from "@/types"; import type { ApiSuccessResponse } from "@/types"; export const authService = { async login(data: LoginRequest): Promise { // Odoo accepts `login` or `email` in JSON body const res = await api.post("/login", { ...data, email: data.login }); setToken(res.token); return res; }, async logout(): Promise { await api.post("/logout").catch(() => {}); clearToken(); }, async getUser(): Promise { const res = await api.get("/user"); return res.user; }, async resetPassword(data: ResetPasswordRequest): Promise { return api.post("/reset/sendVerification", data); }, async setInvitePassword(data: { token: string; password: string }): Promise { return api.post("/auth/invite/set-password", data); }, };