Added api for add property
All checks were successful
Build frontend / build (push) Successful in 1m39s
All checks were successful
Build frontend / build (push) Successful in 1m39s
This commit is contained in:
@ -299,10 +299,35 @@ export async function getMyRentListings() {
|
||||
return apiFetch("/RentProperties/GetMyRentListings");
|
||||
}
|
||||
|
||||
export function buildRentPropertyPayload(data = {}) {
|
||||
const propertyInformation = data?.propertyInformation || {};
|
||||
const cityValue =
|
||||
data?.city ??
|
||||
data?.governorate ??
|
||||
propertyInformation?.city ??
|
||||
propertyInformation?.governorate ??
|
||||
"";
|
||||
const documentTypeValue =
|
||||
data?.documentType ?? propertyInformation?.documentType ?? "";
|
||||
|
||||
return {
|
||||
...data,
|
||||
city: cityValue,
|
||||
governorate: cityValue,
|
||||
documentType: documentTypeValue,
|
||||
propertyInformation: {
|
||||
...propertyInformation,
|
||||
city: cityValue,
|
||||
governorate: propertyInformation?.governorate ?? cityValue,
|
||||
documentType: documentTypeValue,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export async function addRentProperty(data) {
|
||||
return apiFetch("/RentProperties/AddRentProperty", {
|
||||
method: "POST",
|
||||
body: data,
|
||||
body: buildRentPropertyPayload(data),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user