mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
add Invalid token handler
This commit is contained in:
@@ -41,13 +41,19 @@ ReactDOM.render((
|
|||||||
loadingCover.parentNode.removeChild(loadingCover)
|
loadingCover.parentNode.removeChild(loadingCover)
|
||||||
|
|
||||||
// Refresh user information
|
// Refresh user information
|
||||||
|
if (auth.user() != null) {
|
||||||
fetchCurrentUser()
|
fetchCurrentUser()
|
||||||
.then(function (res) {
|
.then(function (res) {
|
||||||
let user = res.body
|
let user = res.body
|
||||||
store.dispatch(updateUser(user))
|
store.dispatch(updateUser(user))
|
||||||
})
|
})
|
||||||
.catch(function (err) {
|
.catch(function (err) {
|
||||||
|
if (err.status === 401) {
|
||||||
|
auth.clear()
|
||||||
|
if (window != null) window.location.reload()
|
||||||
|
}
|
||||||
console.error(err.message)
|
console.error(err.message)
|
||||||
console.log('Fetch failed')
|
console.log('Fetch failed')
|
||||||
})
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user