Feature: Provide api endpoint for reviewing addresses

Feature: show warning when address does not match the reference

Feature: [address] do update the address from address reference when clicked inside address details
This commit is contained in:
2023-03-16 18:43:12 +01:00
parent 21e24c60c7
commit 8177a0fcce
12 changed files with 374 additions and 43 deletions

View File

@@ -21,3 +21,11 @@ export const getGeographicalUnitsByAddress = async (address: Address): Promise<S
export const getAllGeographicalUnitLayers = async (): Promise<GeographicalUnitLayer[]> => {
return fetchResults<GeographicalUnitLayer>(`/api/1.0/main/geographical-unit-layer.json`);
}
export const syncAddressWithReference = async (address: Address): Promise<Address> => {
return makeFetch<null, Address>("POST", `/api/1.0/main/address/reference-match/${address.address_id}/sync-with-reference`);
}
export const markAddressReviewed = async (address: Address): Promise<Address> => {
return makeFetch<null, Address>("POST", `/api/1.0/main/address/reference-match/${address.address_id}/set/reviewed`);
}

View File

@@ -67,9 +67,6 @@ export const makeFetch = <Input, Output>(method: 'POST'|'GET'|'PUT'|'PATCH'|'DEL
},
};
console.log('for url '+url, body);
console.log('for url '+url, body !== null);
if (body !== null && typeof body !== 'undefined') {
Object.assign(opts, {body: JSON.stringify(body)})
}
@@ -77,9 +74,6 @@ export const makeFetch = <Input, Output>(method: 'POST'|'GET'|'PUT'|'PATCH'|'DEL
if (typeof options !== 'undefined') {
opts = Object.assign(opts, options);
}
console.log('will fetch', url);
console.log('content for ' + url, opts);
return fetch(url, opts)
.then(response => {
if (response.ok) {