|
@@ -1,18 +1,12 @@
|
|
|
import { SWRResponse } from 'swr';
|
|
import { SWRResponse } from 'swr';
|
|
|
import useSWRImmutable from 'swr/immutable';
|
|
import useSWRImmutable from 'swr/immutable';
|
|
|
|
|
|
|
|
-import { ITagHasCount } from '~/interfaces/tag';
|
|
|
|
|
|
|
+import { ITagsListApiv1Result } from '~/interfaces/tag';
|
|
|
|
|
|
|
|
import { apiGet } from '../client/util/apiv1-client';
|
|
import { apiGet } from '../client/util/apiv1-client';
|
|
|
|
|
|
|
|
|
|
|
|
|
-export type ITagsApiv1Result = {
|
|
|
|
|
- ok: boolean,
|
|
|
|
|
- data: ITagHasCount[],
|
|
|
|
|
- totalCount: number,
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-export const useSWRxTagsList = (limit?: number, offset?: number): SWRResponse<ITagsApiv1Result, Error> => {
|
|
|
|
|
|
|
+export const useSWRxTagsList = (limit?: number, offset?: number): SWRResponse<ITagsListApiv1Result, Error> => {
|
|
|
return useSWRImmutable(['/tags.list', limit, offset],
|
|
return useSWRImmutable(['/tags.list', limit, offset],
|
|
|
- (endpoint, limit, offset) => apiGet(endpoint, { limit, offset }).then(response => response as ITagsApiv1Result));
|
|
|
|
|
|
|
+ (endpoint, limit, offset) => apiGet(endpoint, { limit, offset }).then(result => result as ITagsListApiv1Result));
|
|
|
};
|
|
};
|