mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-08 12:58:38 +02:00
Handle native app token refresh failure notification
This commit is contained in:
@@ -131,4 +131,14 @@ export default ({ app, store }, inject) => {
|
||||
console.log('[db] onTokenRefresh', data)
|
||||
store.commit('user/setAccessToken', data.accessToken)
|
||||
})
|
||||
|
||||
// Listen for token refresh failure events from native app
|
||||
AbsDatabase.addListener('onTokenRefreshFailure', async (data) => {
|
||||
console.log('[db] onTokenRefreshFailure', data)
|
||||
// Clear store and redirect to login page
|
||||
await store.dispatch('user/logout')
|
||||
if (window.location.pathname !== '/connect') {
|
||||
window.location.href = '/connect'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ export default function ({ store, $db }, inject) {
|
||||
try {
|
||||
console.log('[nativeHttp] Handling refresh failure - logging out user')
|
||||
|
||||
// Logout from server and clear store
|
||||
// Clear store
|
||||
await store.dispatch('user/logout')
|
||||
|
||||
if (serverConnectionConfigId) {
|
||||
|
||||
Reference in New Issue
Block a user