Shun Miyazawa 4 лет назад
Родитель
Сommit
0c099606a9
2 измененных файлов с 9 добавлено и 9 удалено
  1. 6 0
      packages/app/src/interfaces/tag.ts
  2. 3 9
      packages/app/src/stores/tag.tsx

+ 6 - 0
packages/app/src/interfaces/tag.ts

@@ -9,3 +9,9 @@ export type ITagsSearchApiv1Result = {
   ok: boolean,
   tags: string[]
 }
+
+export type ITagsListApiv1Result = {
+  ok: boolean,
+  data: ITagHasCount[],
+  totalCount: number,
+}

+ 3 - 9
packages/app/src/stores/tag.tsx

@@ -1,18 +1,12 @@
 import { SWRResponse } from 'swr';
 import useSWRImmutable from 'swr/immutable';
 
-import { ITagHasCount } from '~/interfaces/tag';
+import { ITagsListApiv1Result } from '~/interfaces/tag';
 
 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],
-    (endpoint, limit, offset) => apiGet(endpoint, { limit, offset }).then(response => response as ITagsApiv1Result));
+    (endpoint, limit, offset) => apiGet(endpoint, { limit, offset }).then(result => result as ITagsListApiv1Result));
 };