dashboard: Fix historical version compatibility problem for auth check via localStorage (#1473)

This commit is contained in:
cdfive 2020-05-15 11:18:53 +08:00 committed by GitHub
parent 2b68a6c062
commit 46076b34aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 3 deletions

View File

@ -27,7 +27,15 @@ angular.module('sentinelDashboardApp')
}
});
} else {
handleLogout($scope, JSON.parse($window.localStorage.getItem("session_sentinel_admin")).id)
try {
var id = JSON.parse($window.localStorage.getItem("session_sentinel_admin")).id;
handleLogout($scope, id);
} catch (e) {
// Historical version compatibility processing, fixes issue-1449
// If error happens while parsing, remove item in localStorage and redirect to login page.
$window.localStorage.removeItem("session_sentinel_admin");
$state.go('login');
}
}
function handleLogout($scope, id) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long