mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-20 22:16:26 +00:00
feat(map): amap as map api provider and display template
This commit is contained in:
@@ -46,7 +46,15 @@ interface AuthState {
|
||||
devMode: boolean
|
||||
isPrerelease: boolean
|
||||
appVersion: string
|
||||
/** Google Maps API key. Please note that secondary map api provider is available,
|
||||
* check `hasAmapKey`. */
|
||||
hasMapsKey: boolean
|
||||
/** The same question for the Amap key, and the admin's provider choice. Not
|
||||
* boolean "hasSearchKey": a notice that says "add a Google key" on an install
|
||||
* whose admin picked Amap is wrong twice, and the two facts together are what
|
||||
* the place-search notices need to say something true. */
|
||||
hasAmapKey: boolean
|
||||
placesProvider: string
|
||||
serverTimezone: string
|
||||
/** Server policy: all users must enable MFA */
|
||||
appRequireMfa: boolean
|
||||
@@ -75,6 +83,8 @@ interface AuthState {
|
||||
setIsPrerelease: (val: boolean) => void
|
||||
setAppVersion: (val: string) => void
|
||||
setHasMapsKey: (val: boolean) => void
|
||||
setHasAmapKey: (val: boolean) => void
|
||||
setPlacesProvider: (val: string) => void
|
||||
setServerTimezone: (tz: string) => void
|
||||
setAppRequireMfa: (val: boolean) => void
|
||||
setTripRemindersEnabled: (val: boolean) => void
|
||||
@@ -125,6 +135,8 @@ export const useAuthStore = create<AuthState>()(
|
||||
isPrerelease: false,
|
||||
appVersion: '',
|
||||
hasMapsKey: false,
|
||||
hasAmapKey: false,
|
||||
placesProvider: 'auto',
|
||||
serverTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
||||
appRequireMfa: false,
|
||||
tripRemindersEnabled: false,
|
||||
@@ -343,6 +355,9 @@ export const useAuthStore = create<AuthState>()(
|
||||
if ('maps_api_key' in keys) {
|
||||
set({ hasMapsKey: !!keys.maps_api_key })
|
||||
}
|
||||
if ('amap_api_key' in keys) {
|
||||
set({ hasAmapKey: !!keys.amap_api_key })
|
||||
}
|
||||
} catch (err: unknown) {
|
||||
throw new Error(getApiErrorMessage(err, 'Error saving API keys'))
|
||||
}
|
||||
@@ -386,6 +401,8 @@ export const useAuthStore = create<AuthState>()(
|
||||
setIsPrerelease: (val: boolean) => set({ isPrerelease: val }),
|
||||
setAppVersion: (val: string) => set({ appVersion: val }),
|
||||
setHasMapsKey: (val: boolean) => set({ hasMapsKey: val }),
|
||||
setHasAmapKey: (val: boolean) => set({ hasAmapKey: val }),
|
||||
setPlacesProvider: (val: string) => set({ placesProvider: val }),
|
||||
setServerTimezone: (tz: string) => set({ serverTimezone: tz }),
|
||||
setAppRequireMfa: (val: boolean) => set({ appRequireMfa: val }),
|
||||
setTripRemindersEnabled: (val: boolean) => set({ tripRemindersEnabled: val }),
|
||||
|
||||
Reference in New Issue
Block a user