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',
|
element: 'maps',
|
||||||
state: false,
|
state: false,
|
||||||
});
|
});
|
||||||
store.commit(MutationTypes.SHOW_UI_MODAL, 'login');
|
store.dispatch(ActionTypes.LOGIN, null);
|
||||||
notify('Login required');
|
notify('Login required');
|
||||||
showSplashError('Login required', true, 1);
|
showSplashError('Login required', true, 1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -99,7 +99,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
login = () => store.commit(MutationTypes.SHOW_UI_MODAL, 'login');
|
login = () => store.dispatch(ActionTypes.LOGIN, null);
|
||||||
|
|
||||||
watch(chatBoxVisible, newValue => {
|
watch(chatBoxVisible, newValue => {
|
||||||
if(newValue && sendingEnabled.value) {
|
if(newValue && sendingEnabled.value) {
|
||||||
|
@ -104,7 +104,7 @@ export class LoginControl extends Control {
|
|||||||
notify(logoutError.value);
|
notify(logoutError.value);
|
||||||
}
|
}
|
||||||
} else {
|
} 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> {
|
async [ActionTypes.LOGIN]({state, commit}, data: any): Promise<void> {
|
||||||
await state.currentMapProvider!.login(data);
|
if(data) {
|
||||||
|
await state.currentMapProvider!.login(data);
|
||||||
|
} else {
|
||||||
|
commit(MutationTypes.SHOW_UI_MODAL, 'login');
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async [ActionTypes.LOGOUT]({state}): Promise<void> {
|
async [ActionTypes.LOGOUT]({state}): Promise<void> {
|
||||||
|
Loading…
Reference in New Issue
Block a user