43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import { apiClient } from '../services/apiClient';
|
|
import { User } from '../interfaces';
|
|
|
|
// ─── Types ───────────────────────────────────────────────────────────────────
|
|
|
|
export interface LoginResponse {
|
|
success: boolean;
|
|
message: string;
|
|
}
|
|
|
|
export interface VerifyOtpResponse {
|
|
success: boolean;
|
|
user: User;
|
|
accessToken: string;
|
|
refreshToken: string;
|
|
}
|
|
|
|
export interface UpdateProfileResponse {
|
|
success: boolean;
|
|
user: User;
|
|
}
|
|
|
|
export interface LogoutResponse {
|
|
success: boolean;
|
|
}
|
|
|
|
// ─── Endpoints ───────────────────────────────────────────────────────────────
|
|
|
|
export const loginApi = (mobileNumber: string) =>
|
|
apiClient.post<LoginResponse>('/auth/login', { mobileNumber });
|
|
|
|
export const verifyOtpApi = (mobileNumber: string, otp: string) =>
|
|
apiClient.post<VerifyOtpResponse>('/auth/verify-otp', { mobileNumber, otp });
|
|
|
|
export const updateProfileApi = (data: {
|
|
name: string;
|
|
email: string;
|
|
locationLabels: string[];
|
|
}) => apiClient.put<UpdateProfileResponse>('/auth/profile', data);
|
|
|
|
export const logoutApi = () =>
|
|
apiClient.post<LogoutResponse>('/auth/logout', {});
|