このコミットが含まれているのは:
+16
-25
@@ -1,41 +1,31 @@
|
||||
import {
|
||||
apiGet,
|
||||
isApiError,
|
||||
apiPost,
|
||||
apiPut,
|
||||
} from '@/lib/api'
|
||||
import { apiGet, isApiError, apiPost, apiPut } from '@/lib/api'
|
||||
|
||||
import type {
|
||||
Material,
|
||||
MaterialIndexResponse,
|
||||
MaterialVersion,
|
||||
FetchMaterialsParams,
|
||||
MaterialFilter,
|
||||
MaterialSyncSuppression,
|
||||
MaterialSidebarTag,
|
||||
MaterialTagTree,
|
||||
} from '@/types'
|
||||
import type { Material,
|
||||
MaterialIndexResponse,
|
||||
MaterialVersion,
|
||||
FetchMaterialsParams,
|
||||
MaterialFilter,
|
||||
MaterialSyncSuppression,
|
||||
MaterialSidebarTag,
|
||||
MaterialTagTree } from '@/types'
|
||||
|
||||
export type FetchMaterialTreeParams = {
|
||||
parentId?: number | null
|
||||
materialFilter: MaterialFilter
|
||||
}
|
||||
materialFilter: MaterialFilter }
|
||||
|
||||
export type MaterialSyncSuppressionResponse = {
|
||||
suppressions: MaterialSyncSuppression[]
|
||||
}
|
||||
export type MaterialSyncSuppressionResponse = { suppressions: MaterialSyncSuppression[] }
|
||||
|
||||
export type MaterialChangesResponse = {
|
||||
versions: MaterialVersion[]
|
||||
count: number
|
||||
}
|
||||
count: number }
|
||||
|
||||
const MATERIAL_FILTERS: MaterialFilter[] = ['present', 'missing', 'any']
|
||||
|
||||
|
||||
export const parseMaterialFilter = (
|
||||
value: unknown,
|
||||
fallback: MaterialFilter = 'present'): MaterialFilter =>
|
||||
fallback: MaterialFilter = 'present',
|
||||
): MaterialFilter =>
|
||||
typeof value === 'string' && MATERIAL_FILTERS.includes (value as MaterialFilter)
|
||||
? value as MaterialFilter
|
||||
: fallback
|
||||
@@ -45,7 +35,8 @@ export const fetchMaterials = async (
|
||||
{ q, tagState, mediaKind, createdFrom, createdTo,
|
||||
updatedFrom, updatedTo, sort, direction, page,
|
||||
tagId, includeDescendants, groupBy,
|
||||
limit }: FetchMaterialsParams): Promise<MaterialIndexResponse> =>
|
||||
limit }: FetchMaterialsParams,
|
||||
): Promise<MaterialIndexResponse> =>
|
||||
await apiGet ('/materials', { params: {
|
||||
...(q && { q }),
|
||||
tag_state: tagState,
|
||||
|
||||
新しい課題から参照
ユーザをブロックする