fix(users): align otp and profile picture api contracts

This commit is contained in:
2026-04-24 22:21:50 +03:30
parent 57e727da19
commit dfe280d9a1

View File

@@ -23,7 +23,7 @@ export const sendOtp = async (mobile: string, mode: string) => {
export const loginWithOtp = async (mobile: string, otp: string) => { export const loginWithOtp = async (mobile: string, otp: string) => {
const response = await authFetch('/api/users/otp/login/', { const response = await authFetch('/api/users/otp/login/', {
method: 'POST', method: 'POST',
body: JSON.stringify({ mobile, otp }) body: JSON.stringify({ mobile, code: otp })
}); });
if (!response.ok) throw new Error('Failed to login with OTP'); if (!response.ok) throw new Error('Failed to login with OTP');
return response.json(); return response.json();
@@ -70,13 +70,11 @@ export const updateProfilePicture = async (file: File) => {
}; };
export const removeProfilePicture = async () => { export const removeProfilePicture = async () => {
const formData = new FormData(); const response = await authFetch(`/api/users/profile/picture/`, {
formData.append('profile_picture', ''); method: 'DELETE',
return authFetch(`/api/users/profile/picture/`, {
method: 'POST',
body: formData,
}); });
if (!response.ok) throw new Error('Failed to remove profile picture');
return response.json();
}; };