virtual tour sidebar info
This commit is contained in:
@@ -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,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 };
|
||||
|
||||
Reference in New Issue
Block a user