diff --git a/src/renderer/api/navidrome/navidrome-api.ts b/src/renderer/api/navidrome/navidrome-api.ts index 76a25c0d..34b24db0 100644 --- a/src/renderer/api/navidrome/navidrome-api.ts +++ b/src/renderer/api/navidrome/navidrome-api.ts @@ -349,7 +349,14 @@ axiosClient.interceptors.response.use( .catch((newError: any) => { if (newError !== TIMEOUT_ERROR) { console.error('Error when trying to reauthenticate: ', newError); - limitedFail(currentServer); + + if (isAxiosError(newError) && newError.code === 'ERR_NETWORK') { + console.log( + 'Network error during reauthentication - preserving credentials', + ); + } else { + limitedFail(currentServer); + } } // make sure to pass the error so axios will error later on @@ -360,7 +367,11 @@ axiosClient.interceptors.response.use( }); } - limitedFail(currentServer); + if (isAxiosError(error) && error.code === 'ERR_NETWORK') { + console.log('Network error during authentication - preserving credentials'); + } else { + limitedFail(currentServer); + } } return Promise.reject(error);