25 lines
541 B
TypeScript
25 lines
541 B
TypeScript
|
|
import { api } from './client'
|
||
|
|
import type {
|
||
|
|
Encounter,
|
||
|
|
CreateEncounterInput,
|
||
|
|
UpdateEncounterInput,
|
||
|
|
} from '../types/game'
|
||
|
|
|
||
|
|
export function createEncounter(
|
||
|
|
runId: number,
|
||
|
|
data: CreateEncounterInput,
|
||
|
|
): Promise<Encounter> {
|
||
|
|
return api.post(`/runs/${runId}/encounters`, data)
|
||
|
|
}
|
||
|
|
|
||
|
|
export function updateEncounter(
|
||
|
|
id: number,
|
||
|
|
data: UpdateEncounterInput,
|
||
|
|
): Promise<Encounter> {
|
||
|
|
return api.patch(`/encounters/${id}`, data)
|
||
|
|
}
|
||
|
|
|
||
|
|
export function deleteEncounter(id: number): Promise<void> {
|
||
|
|
return api.del(`/encounters/${id}`)
|
||
|
|
}
|