Skip to content

Commit

Permalink
fix: 请求发出前更新 CSRF Token (#1679)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuri0528 authored Apr 28, 2024
1 parent 7d09a46 commit ca72306
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/pages/src/http/fetch/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,14 @@ methods.forEach((method) => {
Object.defineProperty(http, method, {
get() {
return <T>(url: string, payload: any = {}, useConfig = {}) => {
updateAxiosInstance();
const config = initConfig(useConfig);

const fetchURL = getFetchURL(url, method, payload);
const axiosRequest = methodsWithData.includes(method)
? axiosInstance[method as Methods]<ServiceResponseData<T>>(fetchURL, payload, config)
: axiosInstance[method as Methods]<ServiceResponseData<T>>(fetchURL, config);

updateAxiosInstance();

return axiosRequest
.then(response => handleResponse<T>({
response,
Expand Down

0 comments on commit ca72306

Please sign in to comment.