All files / src/features/legal/api legal.api.ts

40% Statements 2/5
100% Branches 0/0
50% Functions 1/2
40% Lines 2/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21                      6x 5x                
import { httpClient } from '@/lib/http-client'
 
import {
  legalAcceptanceListSchema,
  legalAcceptanceSchema,
  recordAcceptanceSchema,
  type LegalAcceptance,
  type RecordAcceptanceInput,
} from './legal.schemas'
 
export async function fetchLegalAcceptances(): Promise<LegalAcceptance[]> {
  const response = await httpClient.get<unknown>('/legal/acceptances')
  return legalAcceptanceListSchema.parse(response)
}
 
export async function recordLegalAcceptance(input: RecordAcceptanceInput): Promise<LegalAcceptance> {
  const body = recordAcceptanceSchema.parse(input)
  const response = await httpClient.post<unknown>('/legal/acceptances', body)
  return legalAcceptanceSchema.parse(response)
}