fix: concurrency
This commit is contained in:
@@ -20,10 +20,7 @@ export const CreateItem = async (query: CreateItemQuery): Promise<ItemPriceRespo
|
||||
item_price: query.item_price
|
||||
})
|
||||
|
||||
const res = await axios.post(process.env.API_URL + `/item/create?${queryParams.toString()}`)
|
||||
if (res.data.Location) {
|
||||
window.location.href = res.data.Location
|
||||
}
|
||||
const res = await axios.post(process.env.NEXT_PUBLIC_API_URL + `/item/create?${queryParams.toString()}`, {}, {withCredentials: true})
|
||||
|
||||
return res.data
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import {OrderTableQuery} from '../request/GetOrderTableRequest'
|
||||
axios.interceptors.response.use(response => {
|
||||
return response;
|
||||
}, async error => {
|
||||
if (error.response.status === 401) {
|
||||
if (error.response?.status === 401) {
|
||||
const resp = await axios.get(process.env.NEXT_PUBLIC_API_URL + "/auth/login", {withCredentials: true})
|
||||
window.location.href = resp.data.Location
|
||||
}
|
||||
|
||||
@@ -9,12 +9,10 @@ export const GetCurrentUser = async (): Promise<UserResponse | undefined> => {
|
||||
console.log(process.env.NEXT_PUBLIC_API_URL + "/user/current")
|
||||
const res = await axios.get(process.env.NEXT_PUBLIC_API_URL + "/user/current", {
|
||||
maxRedirects: 0,
|
||||
withCredentials: true,
|
||||
validateStatus: (status) => {
|
||||
return status >= 200 && status < 400
|
||||
}});
|
||||
if(res.data.Location) {
|
||||
window.location.href = res.data.Location
|
||||
}
|
||||
return res.data;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user