Quellcode durchsuchen

Don't try to refresh token if 401 error on auth/jwt/ endpoint

Fixes https://github.com/lesspass/lesspass/issues/615
pull/618/head
Guillaume Vincent vor 3 Jahren
Ursprung
Commit
94783e1676
1 geänderte Dateien mit 3 neuen und 3 gelöschten Zeilen
  1. +3
    -3
      packages/lesspass-pure/src/api/http.js

+ 3
- 3
packages/lesspass-pure/src/api/http.js Datei anzeigen

@@ -19,16 +19,16 @@ axios.interceptors.response.use(
const refresh = localStorage.getItem("refresh_token"); const refresh = localStorage.getItem("refresh_token");
if ( if (
(error.response && error.response.status !== 401) || (error.response && error.response.status !== 401) ||
(error.config && error.config.url.includes("/api/auth/jwt/")) ||
(error.config && error.config.url.includes("/auth/jwt/")) ||
refresh === null refresh === null
) { ) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
reject(error); reject(error);
}); });
} }
const baseURL = getBaseURL()
const baseURL = getBaseURL();
return axios return axios
.post("/api/auth/jwt/refresh/", { refresh }, { baseURL })
.post("/auth/jwt/refresh/", { refresh }, { baseURL })
.then(response => { .then(response => {
const access_token = response.data.access; const access_token = response.data.access;
localStorage.setItem("access_token", access_token); localStorage.setItem("access_token", access_token);


Laden…
Abbrechen
Speichern