diff --git a/lib/core/auth.js b/lib/core/auth.js index 679144c6d..4cf74672d 100644 --- a/lib/core/auth.js +++ b/lib/core/auth.js @@ -150,9 +150,9 @@ export default class Auth { reset () { if (!this.strategy.reset) { - this.setUser(null) - this.setToken(this.$state.strategy, null) - this.setRefreshToken(this.$state.strategy, null) + this.setUser(false) + this.setToken(this.$state.strategy, false) + this.setRefreshToken(this.$state.strategy, false) return Promise.resolve() } @@ -270,8 +270,7 @@ export default class Auth { if (!_endpoint.headers) { _endpoint.headers = {} } - - if (!_endpoint.headers['Authorization'] && isSet(token)) { + if (!_endpoint.headers['Authorization'] && isSet(token) && token) { _endpoint.headers['Authorization'] = token } diff --git a/lib/core/storage.js b/lib/core/storage.js index bfbe42a81..d3658a725 100644 --- a/lib/core/storage.js +++ b/lib/core/storage.js @@ -156,6 +156,9 @@ export default class Storage { const _key = this.options.localStorage.prefix + key const value = localStorage.getItem(_key) + if (value === 'false') { + return false + } return isJson ? JSON.parse(value) : value } @@ -195,7 +198,9 @@ export default class Storage { const cookies = parseCookie(cookieStr || '') || {} const value = cookies[_key] - + if (value === 'false') { + return false + } return isJson ? JSON.parse(value) : value } }