|
@@ -1,5 +1,6 @@
|
|
|
import useSWR, { SWRResponse } from 'swr';
|
|
import useSWR, { SWRResponse } from 'swr';
|
|
|
|
|
|
|
|
|
|
+import { PaginateResult } from 'mongoose';
|
|
|
import { apiv3Get } from '../client/util/apiv3-client';
|
|
import { apiv3Get } from '../client/util/apiv3-client';
|
|
|
import { IInAppNotification } from '../interfaces/in-app-notification';
|
|
import { IInAppNotification } from '../interfaces/in-app-notification';
|
|
|
|
|
|
|
@@ -7,10 +8,9 @@ import { IInAppNotification } from '../interfaces/in-app-notification';
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
export const useSWRxInAppNotifications = <Data, Error>(
|
|
export const useSWRxInAppNotifications = <Data, Error>(
|
|
|
limit: number,
|
|
limit: number,
|
|
|
-): SWRResponse<any, Error> => {
|
|
|
|
|
|
|
+): SWRResponse<PaginateResult<IInAppNotification>, Error> => {
|
|
|
return useSWR(
|
|
return useSWR(
|
|
|
'/in-app-notification/list',
|
|
'/in-app-notification/list',
|
|
|
- // endpoint => apiv3Get<{ notifications: IInAppNotification[], limit: number }>(endpoint).then(response => response.data?.notifications),
|
|
|
|
|
endpoint => apiv3Get(endpoint, { limit }).then(response => response.data),
|
|
endpoint => apiv3Get(endpoint, { limit }).then(response => response.data),
|
|
|
);
|
|
);
|
|
|
};
|
|
};
|