virtual tour sidebar info

This commit is contained in:
2024-06-27 14:36:11 +05:00
parent 9737340da7
commit d499a1dd13
19 changed files with 395 additions and 145 deletions
+18 -3
View File
@@ -1,5 +1,6 @@
import { apartmentsApi } from "./urls";
import { apartmentsApi, currentApartmentApi } from "./urls";
import ky from "ky";
import { IApartmentRes, IApartmentsRes } from "../types/apartmentsRes";
async function getApartments(
token: string | null,
@@ -11,7 +12,7 @@ async function getApartments(
sortBy?: string | undefined,
page?: number,
perPage?: number
) {
): Promise<IApartmentsRes> {
const roveHomeQuery =
roveHomeFilters && roveHomeFilters.length !== 0
? `rove_home=${roveHomeFilters.join(",")}`
@@ -61,4 +62,18 @@ async function getApartments(
return res.json();
}
export { getApartments };
async function getCurrentApartment(
token: string | null,
id: string
): Promise<IApartmentRes> {
const url = `${currentApartmentApi}/${id}`;
const res = await ky.get(url, {
headers: {
Authorization: `Zoho-oauthtoken ${token}`,
},
});
return res.json();
}
export { getApartments, getCurrentApartment };
+3 -1
View File
@@ -3,6 +3,8 @@ const serverApi = import.meta.env.VITE_SERVER_API;
const apartmentsApi = `${serverApi}/apartments`;
const currentApartmentApi = `${serverApi}/apartment`;
const updateAccessTokenApi = `${serverApi}/updateAccessToken`;
export { apartmentsApi, updateAccessTokenApi };
export { apartmentsApi, updateAccessTokenApi, currentApartmentApi };