Update registration to match new API schema
All checks were successful
Build frontend / build (push) Successful in 37s
All checks were successful
Build frontend / build (push) Successful in 37s
- FullName split into FirstName + LastName in both forms and API
- File fields renamed: FrontIdCarImage -> FrontIdCarImagePath, RearIdCarImage -> RearIdCarImagePath
- Added Language field to form data
- getRentProperty now uses /RentProperties/GetRentPropertyById/{id}
This commit is contained in:
@ -81,9 +81,7 @@ export async function getRentProperties() {
|
||||
}
|
||||
|
||||
export async function getRentProperty(id) {
|
||||
const items = await apiFetch('/RentProperties/GetRentProperties');
|
||||
if (!Array.isArray(items)) return items;
|
||||
return items.find(p => p.id == id) || items[0];
|
||||
return apiFetch(`/RentProperties/GetRentPropertyById/${id}`);
|
||||
}
|
||||
|
||||
export async function getRentPropertyLocations(params = {}) {
|
||||
@ -190,15 +188,18 @@ export async function addOwner(data, frontImage = null, backImage = null) {
|
||||
console.log('[Auth] Registering owner (multipart):', data.email);
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('FullName', data.name || data.FullName || '');
|
||||
formData.append('FirstName', data.firstName || data.FirstName || '');
|
||||
formData.append('LastName', data.lastName || data.LastName || '');
|
||||
formData.append('Email', data.email || '');
|
||||
formData.append('PhoneNumber', data.phoneNumber || '');
|
||||
formData.append('WhatsAppNumber', data.whatsAppNumber || '');
|
||||
formData.append('NationalNumber', data.nationalNumber || '');
|
||||
formData.append('Password', data.password || '');
|
||||
formData.append('Type', String(data.ownerType ?? data.Type ?? 0));
|
||||
formData.append('Language', '0');
|
||||
|
||||
if (frontImage) formData.append('FrontIdCarImage', frontImage);
|
||||
if (backImage) formData.append('RearIdCarImage', backImage);
|
||||
if (frontImage) formData.append('FrontIdCarImagePath', frontImage);
|
||||
if (backImage) formData.append('RearIdCarImagePath', backImage);
|
||||
|
||||
return multipartAuthFetch('/Owner/Add', formData);
|
||||
}
|
||||
@ -207,14 +208,18 @@ export async function addCustomer(data, frontImage = null, backImage = null) {
|
||||
console.log('[Auth] Registering customer (multipart):', data.email);
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('FullName', data.name || data.FullName || '');
|
||||
formData.append('FirstName', data.firstName || data.FirstName || '');
|
||||
formData.append('LastName', data.lastName || data.LastName || '');
|
||||
formData.append('Email', data.email || '');
|
||||
formData.append('PhoneNumber', data.phoneNumber || '');
|
||||
formData.append('WhatsAppNumber', data.whatsAppNumber || '');
|
||||
formData.append('NationalNumber', data.nationalNumber || '');
|
||||
formData.append('Password', data.password || '');
|
||||
formData.append('Type', String(data.customerType ?? data.Type ?? 0));
|
||||
formData.append('Language', '0');
|
||||
|
||||
if (frontImage) formData.append('FrontIdCarImage', frontImage);
|
||||
if (backImage) formData.append('RearIdCarImage', backImage);
|
||||
if (frontImage) formData.append('FrontIdCarImagePath', frontImage);
|
||||
if (backImage) formData.append('RearIdCarImagePath', backImage);
|
||||
|
||||
return multipartAuthFetch('/Customer/Add', formData);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user