31 lines
1.2 KiB
TypeScript
31 lines
1.2 KiB
TypeScript
import { apiClient } from '../services/apiClient';
|
|
import { LoginResponse, User, VerifyOtpResponse } from '../interfaces';
|
|
|
|
// ─── Types ───────────────────────────────────────────────────────────────────
|
|
|
|
export interface UpdateProfileResponse {
|
|
success: boolean;
|
|
user: User;
|
|
}
|
|
|
|
export interface LogoutResponse {
|
|
success: boolean;
|
|
}
|
|
|
|
// ─── Endpoints ───────────────────────────────────────────────────────────────
|
|
|
|
export const loginApi = (phone: string) =>
|
|
apiClient.post<LoginResponse>('/auth/otp/request', { phone });
|
|
|
|
export const verifyOtpApi = (phone: string, code: string, role: string) =>
|
|
apiClient.post<VerifyOtpResponse>('/auth/otp/verify', { phone, code, role });
|
|
|
|
export const updateProfileApi = (data: {
|
|
name: string;
|
|
email: string;
|
|
locationLabels: string[];
|
|
}) => apiClient.put<UpdateProfileResponse>('/auth/profile', data);
|
|
|
|
export const logoutApi = () =>
|
|
apiClient.post<LogoutResponse>('/auth/logout', {});
|