history orders
This commit is contained in:
@@ -59,15 +59,8 @@ axiosInstance.interceptors.response.use(
|
||||
token: refreshTokenValue,
|
||||
});
|
||||
|
||||
// Support both response structures
|
||||
const accessToken =
|
||||
data?.results?.data?.accessToken?.token ||
|
||||
data?.data?.tokens?.accessToken?.token ||
|
||||
data?.accessToken;
|
||||
const refreshTokenValueNew =
|
||||
data?.results?.data?.refreshToken?.token ||
|
||||
data?.data?.tokens?.refreshToken?.token ||
|
||||
data?.refreshToken;
|
||||
const accessToken = data?.data?.accessToken?.token;
|
||||
const refreshTokenValueNew = data?.data?.refreshToken?.token;
|
||||
|
||||
if (accessToken) {
|
||||
await setToken(accessToken);
|
||||
@@ -88,9 +81,9 @@ axiosInstance.interceptors.response.use(
|
||||
await removeToken();
|
||||
await removeRefreshToken();
|
||||
if (typeof window !== "undefined") {
|
||||
const pathname = window.location.pathname;
|
||||
const slug = pathname.split("/")[1];
|
||||
window.location.href = slug ? `/${slug}` : `/`;
|
||||
// const pathname = window.location.pathname;
|
||||
// const slug = pathname.split("/")[1];
|
||||
// window.location.href = slug ? `/${slug}` : `/`;
|
||||
}
|
||||
return Promise.reject(refreshError);
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user