mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
do not logout when trying to reconnect to the server since the session should still be valid
This commit is contained in:
parent
8db7691fe2
commit
1d892350cd
4 changed files with 14 additions and 11 deletions
|
@ -217,12 +217,12 @@ export default {
|
||||||
const api = this
|
const api = this
|
||||||
|
|
||||||
function reconnect(n) {
|
function reconnect(n) {
|
||||||
api
|
store
|
||||||
.get('logout', {}, { key: 'reconnecting' })
|
.dispatch('GET_YUNOHOST_INFOS')
|
||||||
.then(resolve)
|
.then(resolve)
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
if (err.name === 'APIUnauthorizedError') {
|
if (err.name === 'APIUnauthorizedError') {
|
||||||
resolve()
|
reject(err)
|
||||||
} else if (n < 1) {
|
} else if (n < 1) {
|
||||||
reject(err)
|
reject(err)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
"unknown": "Connection with the server has been closed for unknown reasons.",
|
"unknown": "Connection with the server has been closed for unknown reasons.",
|
||||||
"upgrade_system": "Connection with the server has been closed due to YunoHost upgrade. Waiting for the server to be reachable again…"
|
"upgrade_system": "Connection with the server has been closed due to YunoHost upgrade. Waiting for the server to be reachable again…"
|
||||||
},
|
},
|
||||||
"success": "The server is now reachable! You can try to login",
|
"session_expired": "The server is now reachable! But it looks like your session expired, please login.",
|
||||||
"title": "Trying to communicate with the server…"
|
"title": "Trying to communicate with the server…"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -179,10 +179,9 @@ export default {
|
||||||
return api.get('logout')
|
return api.get('logout')
|
||||||
},
|
},
|
||||||
|
|
||||||
TRY_TO_RECONNECT({ commit, dispatch }, args = {}) {
|
TRY_TO_RECONNECT({ commit }, args = {}) {
|
||||||
// FIXME This is very ugly arguments forwarding, will use proper component way of doing this when switching to Vue 3 (teleport)
|
// FIXME This is very ugly arguments forwarding, will use proper component way of doing this when switching to Vue 3 (teleport)
|
||||||
commit('SET_RECONNECTING', args)
|
commit('SET_RECONNECTING', args)
|
||||||
dispatch('RESET_CONNECTED')
|
|
||||||
},
|
},
|
||||||
|
|
||||||
GET_YUNOHOST_INFOS({ commit }) {
|
GET_YUNOHOST_INFOS({ commit }) {
|
||||||
|
|
|
@ -28,8 +28,8 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="status === 'success'">
|
<template v-if="status === 'expired'">
|
||||||
<BAlert variant="success" v-t="'api.reconnecting.success'" />
|
<BAlert variant="success" v-t="'api.reconnecting.session_expired'" />
|
||||||
|
|
||||||
<LoginView force-reload />
|
<LoginView force-reload />
|
||||||
</template>
|
</template>
|
||||||
|
@ -66,10 +66,14 @@ export default {
|
||||||
api
|
api
|
||||||
.tryToReconnect({ ...this.reconnecting, initialDelay })
|
.tryToReconnect({ ...this.reconnecting, initialDelay })
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.status = 'success'
|
this.$store.commit('SET_RECONNECTING', null)
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch((err) => {
|
||||||
|
if (err.name === 'APIUnauthorizedError') {
|
||||||
|
this.status = 'expired'
|
||||||
|
} else {
|
||||||
this.status = 'failed'
|
this.status = 'failed'
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue