osrm service checking

This commit is contained in:
muerwre 2019-03-05 16:48:30 +07:00
parent 143f3107e1
commit 9744b0dfd5
8 changed files with 74 additions and 29 deletions

View file

@ -4,6 +4,8 @@ import { IRootState } from "$redux/user/reducer";
import { IUser } from "$constants/auth";
import { ILatLng } from "$modules/Stickers";
import { IStickerDump } from "$modules/Sticker";
import { CLIENT } from '$config/frontend';
import { LatLngLiteral } from "leaflet";
const arrayToObject = (array: any[], key: string): {} => array.reduce((obj, el) => ({ ...obj, [el[key]]: el }), {});
@ -95,3 +97,7 @@ export const getRouteList = ({
}
}).then(result => (result && result.data && result.data.success && result.data))
.catch(() => ({ list: [], min: 0, max: 0, limit: 0, step: 20, shift: 20 }));
export const checkOSRMService = (bounds: LatLngLiteral[]): Promise<boolean> => (
CLIENT && CLIENT.OSRM_URL && axios.get(CLIENT.OSRM_TEST_URL(bounds)).then(() => true).catch(() => false)
);