Kaynağa Gözat

change the swr key to an array and pass params

kaori 4 yıl önce
ebeveyn
işleme
11d5c5ab31

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

@@ -11,7 +11,7 @@ export const useSWRxInAppNotifications = <Data, Error>(
   offset?: number,
   offset?: number,
 ): SWRResponse<PaginateResult<IInAppNotification>, Error> => {
 ): SWRResponse<PaginateResult<IInAppNotification>, Error> => {
   return useSWR(
   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),
   );
   );
 };
 };