diff --git a/src/api/users.ts b/src/api/users.ts index 1314193..921101b 100644 --- a/src/api/users.ts +++ b/src/api/users.ts @@ -20,14 +20,14 @@ export const sendOtp = async (mobile: string, mode: string) => { return response.json(); }; -export const loginWithOtp = async (mobile: string, otp: string) => { - const response = await authFetch('/api/users/otp/login/', { - method: 'POST', - body: JSON.stringify({ mobile, otp }) - }); - if (!response.ok) throw new Error('Failed to login with OTP'); - return response.json(); -}; +export const loginWithOtp = async (mobile: string, otp: string) => { + const response = await authFetch('/api/users/otp/login/', { + method: 'POST', + body: JSON.stringify({ mobile, code: otp }) + }); + if (!response.ok) throw new Error('Failed to login with OTP'); + return response.json(); +}; export const logoutUser = async (refreshToken: string) => { const response = await authFetch('/api/users/logout/', { @@ -69,15 +69,13 @@ export const updateProfilePicture = async (file: File) => { return response.json(); }; -export const removeProfilePicture = async () => { - const formData = new FormData(); - formData.append('profile_picture', ''); - - return authFetch(`/api/users/profile/picture/`, { - method: 'POST', - body: formData, - }); -}; +export const removeProfilePicture = async () => { + const response = await authFetch(`/api/users/profile/picture/`, { + method: 'DELETE', + }); + if (!response.ok) throw new Error('Failed to remove profile picture'); + return response.json(); +}; export interface SearchedUser { @@ -96,4 +94,4 @@ export const searchUserByExactMobile = async (mobile: string): Promise