fix: use type aliases and named response type for consistency

This commit is contained in:
Kirill
2026-05-24 16:24:57 +05:00
parent 5b88a3c9a5
commit 873d98eb1e
@@ -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
}