Feature: show list of geographical units which covers address in address details modal

This commit is contained in:
2023-03-15 15:56:46 +01:00
parent 71d0785ab4
commit 21e24c60c7
8 changed files with 119 additions and 9 deletions

View File

@@ -1,4 +1,5 @@
import {Address} from "../../types";
import {Address, GeographicalUnitLayer, SimpleGeographicalUnit} from "../../types";
import {fetchResults, makeFetch} from "./apiMethods";
export const getAddressById = async (address_id: number): Promise<Address> =>
{
@@ -12,3 +13,11 @@ export const getAddressById = async (address_id: number): Promise<Address> =>
throw Error('Error with request resource response');
};
export const getGeographicalUnitsByAddress = async (address: Address): Promise<SimpleGeographicalUnit[]> => {
return fetchResults<SimpleGeographicalUnit>(`/api/1.0/main/geographical-unit/by-address/${address.address_id}.json`);
}
export const getAllGeographicalUnitLayers = async (): Promise<GeographicalUnitLayer[]> => {
return fetchResults<GeographicalUnitLayer>(`/api/1.0/main/geographical-unit-layer.json`);
}