Sfoglia il codice sorgente

change the swr key to an array and pass params

kaori 4 anni fa
parent
commit
11d5c5ab31
1 ha cambiato i file con 2 aggiunte e 2 eliminazioni
  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),
   );
 };