Просмотр исходного кода

change the swr key to an array and pass params

kaori 4 лет назад
Родитель
Сommit
11d5c5ab31
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      packages/app/src/stores/in-app-notification.ts

+ 2 - 2
packages/app/src/stores/in-app-notification.ts

@@ -11,7 +11,7 @@ export const useSWRxInAppNotifications = <Data, Error>(
   offset?: number,
 ): SWRResponse<PaginateResult<IInAppNotification>, Error> => {
   return useSWR(
-    `/in-app-notification/list?limit=${limit}&offset=${offset}`,
-    endpoint => apiv3Get(endpoint).then(response => response.data),
+    ['/in-app-notification/list', limit, offset],
+    endpoint => apiv3Get(endpoint, { limit, offset }).then(response => response.data),
   );
 };