From 77a0eb41bef6856b64698d94731eef59faf0f682 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Thu, 7 Dec 2023 15:24:45 -0600 Subject: [PATCH] SWRConfig changes for swr 2.x --- web-new/src/api/index.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web-new/src/api/index.tsx b/web-new/src/api/index.tsx index 112945209..b2aa97a08 100644 --- a/web-new/src/api/index.tsx +++ b/web-new/src/api/index.tsx @@ -20,8 +20,10 @@ export function ApiProvider({ children, options }: ApiProviderType) { return ( - axios.get(path, { params }).then((res) => res.data), + fetcher: (key) => { + const [path, params] = Array.isArray(key) ? key : [key, undefined]; + return axios.get(path, { params }).then((res) => res.data); + }, ...options, }} >