fix Navigation.clearHistory
This commit is contained in:
@@ -101,8 +101,7 @@ async function handle401Error() {
|
||||
Utils.showError("Authentication error, please login again");
|
||||
await SLStorage.remove(SLStorage.SETTINGS.API_KEY);
|
||||
EventManager.broadcast(EventManager.EVENT.SETTINGS_CHANGED);
|
||||
Navigation.clearHistory();
|
||||
Navigation.navigateTo(Navigation.PATH.LOGIN);
|
||||
Navigation.clearHistoryAndNavigateTo(Navigation.PATH.LOGIN);
|
||||
}
|
||||
|
||||
function bindQueryParams(url, params) {
|
||||
|
||||
@@ -68,8 +68,10 @@ class Navigation {
|
||||
router.go(-1);
|
||||
}
|
||||
|
||||
static clearHistory() {
|
||||
static clearHistoryAndNavigateTo(path) {
|
||||
router.history.stack = [];
|
||||
router.history.index = -1;
|
||||
setTimeout(() => router.push(path), 10);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -74,8 +74,7 @@ export default {
|
||||
EventManager.broadcast(EventManager.EVENT.SETTINGS_CHANGED);
|
||||
|
||||
Utils.showSuccess(`Hi ${userName}!`);
|
||||
Navigation.clearHistory();
|
||||
Navigation.navigateTo(Navigation.PATH.MAIN);
|
||||
Navigation.clearHistoryAndNavigateTo(Navigation.PATH.MAIN);
|
||||
})
|
||||
.catch((err) => {
|
||||
Utils.showError("Incorrect API Key.");
|
||||
|
||||
@@ -123,8 +123,7 @@ export default {
|
||||
await callAPI(API_ROUTE.LOGOUT, {}, {}, API_ON_ERR.IGNORE);
|
||||
await SLStorage.remove(SLStorage.SETTINGS.API_KEY);
|
||||
EventManager.broadcast(EventManager.EVENT.SETTINGS_CHANGED);
|
||||
Navigation.clearHistory();
|
||||
Navigation.navigateTo(Navigation.PATH.LOGIN);
|
||||
Navigation.clearHistoryAndNavigateTo(Navigation.PATH.LOGIN);
|
||||
},
|
||||
|
||||
async setMailToUri() {
|
||||
|
||||
Reference in New Issue
Block a user