Browse Source

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 3 years ago
parent
commit
94783e1676
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      packages/lesspass-pure/src/api/http.js

+ 3
- 3
packages/lesspass-pure/src/api/http.js View File

@@ -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);


Loading…
Cancel
Save