1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-21 14:19:43 +02:00

Clear localstorage when user permissions change

This commit is contained in:
Harvey Kandola 2018-02-15 17:10:29 +00:00
parent bca306347d
commit fc742a2282

View file

@ -16,6 +16,7 @@ import config from '../config/environment';
export default AjaxService.extend({
session: service(),
localStorage: service(),
host: config.apiHost,
namespace: config.apiNamespace,
@ -39,6 +40,7 @@ export default AjaxService.extend({
// when unauthorized on local API AJAX calls, redirect to app root
if (status === 401 && is.not.undefined(appVersion) && is.not.includes(window.location.href, '/auth')) {
this.get('localStorage').clearAll();
window.location.href = 'auth/login';
}
@ -46,6 +48,7 @@ export default AjaxService.extend({
let latest = JSON.parse(userUpdate);
if (!latest.active || user.editor !== latest.editor || user.admin !== latest.admin || user.viewUsers !== latest.viewUsers) {
this.get('localStorage').clearAll();
window.location.href = 'auth/login';
}
}