feat: input virtual add header request api
This commit is contained in:
parent
fc3b752b97
commit
bbd3f8d252
@ -8,16 +8,6 @@ const createClient = (baseURL, withBaseFormat = false) => {
|
||||
headers: { 'Content-Type': 'application/json', Accept: 'application/json' }
|
||||
});
|
||||
|
||||
client.interceptors.request.use((config) => {
|
||||
const token = typeof window !== 'undefined' ? localStorage.getItem('token') : null;
|
||||
if (token) {
|
||||
config.headers = config.headers ?? {};
|
||||
config.headers.Authorization = `Bearer ${token}`;
|
||||
}
|
||||
|
||||
return config;
|
||||
});
|
||||
|
||||
if (withBaseFormat) {
|
||||
client.interceptors.response.use(
|
||||
(response) =>
|
||||
|
||||
@ -33,6 +33,7 @@ export default function ListVirtual({
|
||||
helperText,
|
||||
filter,
|
||||
isApiGo = false,
|
||||
headersRequest,
|
||||
}) {
|
||||
const [open, setOpen] = useState(false);
|
||||
const [search, setSearch] = useState("");
|
||||
@ -72,7 +73,10 @@ export default function ListVirtual({
|
||||
url,
|
||||
payload.build(),
|
||||
{},
|
||||
{ isApiGo }
|
||||
{
|
||||
isApiGo,
|
||||
headers: headersRequest
|
||||
}
|
||||
);
|
||||
const incomingData = res.data || [];
|
||||
|
||||
@ -125,7 +129,10 @@ export default function ListVirtual({
|
||||
url,
|
||||
payload.build(),
|
||||
{},
|
||||
{ isApiGo }
|
||||
{
|
||||
isApiGo,
|
||||
headers: headersRequest
|
||||
}
|
||||
);
|
||||
|
||||
const data = res.data?.[0];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user