fix Navigation.clearHistory

This commit is contained in:
ngxson
2020-08-01 11:16:10 +02:00
parent 49514d99c9
commit ea0a1cd858
4 changed files with 6 additions and 7 deletions
+1 -2
View File
@@ -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) {
+3 -1
View File
@@ -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);
}
}
+1 -2
View File
@@ -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.");
+1 -2
View File
@@ -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() {