fix: use type aliases and named response type for consistency
This commit is contained in:
@@ -1,21 +1,27 @@
|
||||
import { apiClient } from '@/shared/api/client'
|
||||
|
||||
export interface ChecklistResultDto {
|
||||
export type ChecklistResultDto = {
|
||||
passed: boolean
|
||||
checkedAt: string
|
||||
}
|
||||
|
||||
export interface TestChecklistResponse {
|
||||
export type TestChecklistResponse = {
|
||||
results: Record<string, ChecklistResultDto>
|
||||
}
|
||||
|
||||
export type UpdateChecklistItemResponse = {
|
||||
itemKey: string
|
||||
passed: boolean
|
||||
checkedAt: string
|
||||
}
|
||||
|
||||
export async function fetchTestChecklistResults(): Promise<TestChecklistResponse> {
|
||||
const { data } = await apiClient.get<TestChecklistResponse>('admin/test-checklist')
|
||||
return data
|
||||
}
|
||||
|
||||
export async function updateTestChecklistItem(itemKey: string, passed: boolean): Promise<{ itemKey: string; passed: boolean; checkedAt: string }> {
|
||||
const { data } = await apiClient.patch<{ result: { itemKey: string; passed: boolean; checkedAt: string } }>('admin/test-checklist', { itemKey, passed })
|
||||
export async function updateTestChecklistItem(itemKey: string, passed: boolean): Promise<UpdateChecklistItemResponse> {
|
||||
const { data } = await apiClient.patch<{ result: UpdateChecklistItemResponse }>('admin/test-checklist', { itemKey, passed })
|
||||
return data.result
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user