Commit 9ee3e882 authored by tom's avatar tom

fix condition for fetch x-endpoint header

parent 914a95bb
import React from 'react'; import React from 'react';
import appConfig from 'configs/app/config'; import isNeedProxy from 'lib/api/isNeedProxy';
import type { Params as FetchParams } from 'lib/hooks/useFetch'; import type { Params as FetchParams } from 'lib/hooks/useFetch';
import useFetch from 'lib/hooks/useFetch'; import useFetch from 'lib/hooks/useFetch';
...@@ -27,7 +27,7 @@ export default function useApiFetch() { ...@@ -27,7 +27,7 @@ export default function useApiFetch() {
url, url,
{ {
credentials: 'include', credentials: 'include',
...(resource.endpoint && appConfig.host === 'localhost' ? { ...(resource.endpoint && isNeedProxy() ? {
headers: { headers: {
'x-endpoint': resource.endpoint, 'x-endpoint': resource.endpoint,
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment