Added api for add property
All checks were successful
Build frontend / build (push) Successful in 1m39s

This commit is contained in:
Rahaf
2026-07-04 12:24:13 +03:00
parent 3bef951d5c
commit bb47b05858
3 changed files with 39 additions and 6 deletions

View File

@ -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),
});
}