From 1d892350cd90e6956645325f62300d05bdc4f12d Mon Sep 17 00:00:00 2001 From: axolotle Date: Fri, 29 Dec 2023 17:53:53 +0100 Subject: [PATCH] do not logout when trying to reconnect to the server since the session should still be valid --- app/src/api/api.js | 6 +++--- app/src/i18n/locales/en.json | 2 +- app/src/store/info.js | 3 +-- app/src/views/_partials/ReconnectingDisplay.vue | 14 +++++++++----- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/app/src/api/api.js b/app/src/api/api.js index daeb56b0..e7c8e061 100644 --- a/app/src/api/api.js +++ b/app/src/api/api.js @@ -217,12 +217,12 @@ export default { const api = this function reconnect(n) { - api - .get('logout', {}, { key: 'reconnecting' }) + store + .dispatch('GET_YUNOHOST_INFOS') .then(resolve) .catch((err) => { if (err.name === 'APIUnauthorizedError') { - resolve() + reject(err) } else if (n < 1) { reject(err) } else { diff --git a/app/src/i18n/locales/en.json b/app/src/i18n/locales/en.json index 3e476204..d32f28b2 100644 --- a/app/src/i18n/locales/en.json +++ b/app/src/i18n/locales/en.json @@ -31,7 +31,7 @@ "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…" }, - "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…" } }, diff --git a/app/src/store/info.js b/app/src/store/info.js index 9bed6a85..5bc5ce3f 100644 --- a/app/src/store/info.js +++ b/app/src/store/info.js @@ -179,10 +179,9 @@ export default { 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) commit('SET_RECONNECTING', args) - dispatch('RESET_CONNECTED') }, GET_YUNOHOST_INFOS({ commit }) { diff --git a/app/src/views/_partials/ReconnectingDisplay.vue b/app/src/views/_partials/ReconnectingDisplay.vue index 5d33778a..65e94c4a 100644 --- a/app/src/views/_partials/ReconnectingDisplay.vue +++ b/app/src/views/_partials/ReconnectingDisplay.vue @@ -28,8 +28,8 @@ -