import { Location } from '@adalo/constants' import { SET_CURRENT_LOCATION, API_LOCATION_REJECTED, DEVICE_LOCATION_REJECTED, } from 'ducks/location' export interface IGeolocationPosition { latitude: number longitude: number } export interface IGeolocationPositionError { code: number message: string } interface LocationSuccessAction { type: typeof SET_CURRENT_LOCATION payload: Location } interface LocationErrorAction { type: typeof DEVICE_LOCATION_REJECTED | typeof API_LOCATION_REJECTED payload: IGeolocationPositionError } export type LocationReducerAction = LocationSuccessAction | LocationErrorAction export class GeolocationPositionError extends Error implements IGeolocationPositionError { constructor(public message: string, public code: number = 0) { super() } }