mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-08-24 03:25:31 +02:00
Update to not logout from server when switching servers, force users to re-login if using old auth
This commit is contained in:
parent
44613e12f1
commit
f6e2e4010f
7 changed files with 105 additions and 45 deletions
|
@ -28,6 +28,7 @@ export default function ({ store, $db }, inject) {
|
|||
delete options.headers
|
||||
}
|
||||
console.log(`[nativeHttp] Making ${method} request to ${url}`)
|
||||
|
||||
return CapacitorHttp.request({
|
||||
method,
|
||||
url,
|
||||
|
@ -177,7 +178,7 @@ export default function ({ store, $db }, inject) {
|
|||
refreshToken: tokens.refreshToken
|
||||
}
|
||||
|
||||
// Save updated config to secure storage
|
||||
// Save updated config to secure storage, persists refresh token in secure storage
|
||||
const savedConfig = await $db.setServerConnectionConfig(updatedConfig)
|
||||
|
||||
// Update the store
|
||||
|
@ -204,7 +205,12 @@ export default function ({ store, $db }, inject) {
|
|||
console.log('[nativeHttp] Handling refresh failure - logging out user')
|
||||
|
||||
// Logout from server and clear store
|
||||
await store.dispatch('user/logout', { serverConnectionConfigId })
|
||||
await store.dispatch('user/logout')
|
||||
|
||||
if (serverConnectionConfigId) {
|
||||
// Clear refresh token for server connection config
|
||||
await $db.clearRefreshToken(serverConnectionConfigId)
|
||||
}
|
||||
|
||||
// Redirect to login page
|
||||
if (window.location.pathname !== '/connect') {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue