SWRConfig changes for swr 2.x

This commit is contained in:
Josh Hawkins 2023-12-07 15:24:45 -06:00
parent 7cf04db975
commit 77a0eb41be

View File

@ -20,8 +20,10 @@ export function ApiProvider({ children, options }: ApiProviderType) {
return ( return (
<SWRConfig <SWRConfig
value={{ value={{
fetcher: (path, params) => fetcher: (key) => {
axios.get(path, { params }).then((res) => res.data), const [path, params] = Array.isArray(key) ? key : [key, undefined];
return axios.get(path, { params }).then((res) => res.data);
},
...options, ...options,
}} }}
> >