|
1 |
| -import { ASSETS_CATEGORIES, IMAGE_CATEGORIES } from 'features/gallery/store/types'; |
2 |
| -import type { |
3 |
| - BoardDTO, |
4 |
| - CreateBoardArg, |
5 |
| - ListBoardsArgs, |
6 |
| - OffsetPaginatedResults_ImageDTO_, |
7 |
| - UpdateBoardArg, |
8 |
| -} from 'services/api/types'; |
9 |
| -import { getListImagesUrl } from 'services/api/util'; |
| 1 | +import type { BoardDTO, CreateBoardArg, ListBoardsArgs, S, UpdateBoardArg } from 'services/api/types'; |
10 | 2 |
|
11 | 3 | import type { ApiTagDescription } from '..';
|
12 | 4 | import { api, buildV1Url, LIST_TAG } from '..';
|
@@ -55,38 +47,11 @@ export const boardsApi = api.injectEndpoints({
|
55 | 47 | keepUnusedDataFor: 0,
|
56 | 48 | }),
|
57 | 49 |
|
58 |
| - getBoardImagesTotal: build.query<{ total: number }, string | undefined>({ |
59 |
| - query: (board_id) => ({ |
60 |
| - url: getListImagesUrl({ |
61 |
| - board_id: board_id ?? 'none', |
62 |
| - categories: IMAGE_CATEGORIES, |
63 |
| - is_intermediate: false, |
64 |
| - limit: 0, |
65 |
| - offset: 0, |
66 |
| - }), |
67 |
| - method: 'GET', |
| 50 | + getUncategorizedImageCounts: build.query<S['UncategorizedImageCounts'], void>({ |
| 51 | + query: () => ({ |
| 52 | + url: buildBoardsUrl('uncategorized/counts'), |
68 | 53 | }),
|
69 |
| - providesTags: (result, error, arg) => [{ type: 'BoardImagesTotal', id: arg ?? 'none' }, 'FetchOnReconnect'], |
70 |
| - transformResponse: (response: OffsetPaginatedResults_ImageDTO_) => { |
71 |
| - return { total: response.total }; |
72 |
| - }, |
73 |
| - }), |
74 |
| - |
75 |
| - getBoardAssetsTotal: build.query<{ total: number }, string | undefined>({ |
76 |
| - query: (board_id) => ({ |
77 |
| - url: getListImagesUrl({ |
78 |
| - board_id: board_id ?? 'none', |
79 |
| - categories: ASSETS_CATEGORIES, |
80 |
| - is_intermediate: false, |
81 |
| - limit: 0, |
82 |
| - offset: 0, |
83 |
| - }), |
84 |
| - method: 'GET', |
85 |
| - }), |
86 |
| - providesTags: (result, error, arg) => [{ type: 'BoardAssetsTotal', id: arg ?? 'none' }, 'FetchOnReconnect'], |
87 |
| - transformResponse: (response: OffsetPaginatedResults_ImageDTO_) => { |
88 |
| - return { total: response.total }; |
89 |
| - }, |
| 54 | + providesTags: ['UncategorizedImageCounts', { type: 'Board', id: LIST_TAG }, { type: 'Board', id: 'none' }], |
90 | 55 | }),
|
91 | 56 |
|
92 | 57 | /**
|
@@ -124,9 +89,8 @@ export const boardsApi = api.injectEndpoints({
|
124 | 89 |
|
125 | 90 | export const {
|
126 | 91 | useListAllBoardsQuery,
|
127 |
| - useGetBoardImagesTotalQuery, |
128 |
| - useGetBoardAssetsTotalQuery, |
129 | 92 | useCreateBoardMutation,
|
130 | 93 | useUpdateBoardMutation,
|
131 | 94 | useListAllImageNamesForBoardQuery,
|
| 95 | + useGetUncategorizedImageCountsQuery, |
132 | 96 | } = boardsApi;
|
0 commit comments