Simplify login logic
Let LOGIN action handle displaying the modal if required.
This commit is contained in:
parent
fff8ad0994
commit
46c4e6d3eb
@ -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 {
|
||||
|
@ -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) {
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -202,7 +202,11 @@ export const actions: ActionTree<State, State> & Actions = {
|
||||
},
|
||||
|
||||
async [ActionTypes.LOGIN]({state, commit}, data: any): Promise<void> {
|
||||
if(data) {
|
||||
await state.currentMapProvider!.login(data);
|
||||
} else {
|
||||
commit(MutationTypes.SHOW_UI_MODAL, 'login');
|
||||
}
|
||||
},
|
||||
|
||||
async [ActionTypes.LOGOUT]({state}): Promise<void> {
|
||||
|
Loading…
Reference in New Issue
Block a user