Ver a proveniência

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 há 3 anos
ascendente
cometimento
94783e1676
1 ficheiros alterados com 3 adições e 3 eliminações
  1. +3
    -3
      packages/lesspass-pure/src/api/http.js

+ 3
- 3
packages/lesspass-pure/src/api/http.js Ver ficheiro

@@ -19,16 +19,16 @@ axios.interceptors.response.use(
const refresh = localStorage.getItem("refresh_token");
if (
(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
) {
return new Promise((resolve, reject) => {
reject(error);
});
}
const baseURL = getBaseURL()
const baseURL = getBaseURL();
return axios
.post("/api/auth/jwt/refresh/", { refresh }, { baseURL })
.post("/auth/jwt/refresh/", { refresh }, { baseURL })
.then(response => {
const access_token = response.data.access;
localStorage.setItem("access_token", access_token);


Carregando…
Cancelar
Guardar