fix swr fetcher

This commit is contained in:
Blake Blackshear 2022-05-12 12:05:34 -05:00
parent 0e9c8a4ddd
commit da36f25fd0

View File

@ -10,13 +10,7 @@ export function ApiProvider({ children, options }) {
return (
<SWRConfig
value={{
fetcher: (arg) => {
if (typeof arg === 'string') {
return axios.get(arg).then((res) => res.data);
}
const [path, params] = arg;
return axios.get(path, { params }).then((res) => res.data);
},
fetcher: (path, params) => axios.get(path, { params }).then((res) => res.data),
...options,
}}
>