|
@@ -1,15 +1,15 @@
|
|
|
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';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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,
|
|
|
offset?: number,
|
|
offset?: number,
|
|
|
-): SWRResponse<PaginateResult<IInAppNotification>, Error> => {
|
|
|
|
|
|
|
+// TODO: import @types/mongoose-paginate-v2 and use PaginateResult as a type after upgrading mongoose v6.0.0
|
|
|
|
|
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
|
|
|
+): SWRResponse<any, Error> => {
|
|
|
return useSWR(
|
|
return useSWR(
|
|
|
['/in-app-notification/list', limit, offset],
|
|
['/in-app-notification/list', limit, offset],
|
|
|
endpoint => apiv3Get(endpoint, { limit, offset }).then(response => response.data),
|
|
endpoint => apiv3Get(endpoint, { limit, offset }).then(response => response.data),
|