diff --git a/src/App.vue b/src/App.vue index 05d40fa..8172da1 100644 --- a/src/App.vue +++ b/src/App.vue @@ -194,7 +194,7 @@ export default defineComponent({ element: 'maps', state: false, }); - store.commit(MutationTypes.SHOW_UI_MODAL, 'login'); + store.dispatch(ActionTypes.LOGIN, null); notify('Login required'); showSplashError('Login required', true, 1); } else { diff --git a/src/components/ChatBox.vue b/src/components/ChatBox.vue index f2b62ed..9b3787f 100644 --- a/src/components/ChatBox.vue +++ b/src/components/ChatBox.vue @@ -99,7 +99,7 @@ } }, - login = () => store.commit(MutationTypes.SHOW_UI_MODAL, 'login'); + login = () => store.dispatch(ActionTypes.LOGIN, null); watch(chatBoxVisible, newValue => { if(newValue && sendingEnabled.value) { diff --git a/src/leaflet/control/LoginControl.ts b/src/leaflet/control/LoginControl.ts index fab0843..5a7dfbd 100644 --- a/src/leaflet/control/LoginControl.ts +++ b/src/leaflet/control/LoginControl.ts @@ -104,7 +104,7 @@ export class LoginControl extends Control { notify(logoutError.value); } } else { - this.store.commit(MutationTypes.SHOW_UI_MODAL, 'login'); + await this.store.dispatch(ActionTypes.LOGIN, null) } } } diff --git a/src/store/actions.ts b/src/store/actions.ts index 1b7ae55..6c302b4 100644 --- a/src/store/actions.ts +++ b/src/store/actions.ts @@ -202,7 +202,11 @@ export const actions: ActionTree & Actions = { }, async [ActionTypes.LOGIN]({state, commit}, data: any): Promise { - await state.currentMapProvider!.login(data); + if(data) { + await state.currentMapProvider!.login(data); + } else { + commit(MutationTypes.SHOW_UI_MODAL, 'login'); + } }, async [ActionTypes.LOGOUT]({state}): Promise {