feat: extend createCharacter API to accept full character fields
This commit is contained in:
parent
6ecdda51f6
commit
3e6749de5f
1 changed files with 14 additions and 4 deletions
|
|
@ -69,10 +69,20 @@ export const joinCampaign = (token: string) =>
|
|||
// Characters
|
||||
export const getCharacters = (campaignId: number) =>
|
||||
request<Character[]>(`/campaigns/${campaignId}/characters`);
|
||||
export const createCharacter = (
|
||||
campaignId: number,
|
||||
data: { name: string; class?: string; ancestry?: string; hp_max?: number },
|
||||
) =>
|
||||
export interface CreateCharacterData {
|
||||
name: string;
|
||||
class?: string;
|
||||
ancestry?: string;
|
||||
alignment?: string;
|
||||
background?: string;
|
||||
deity?: string;
|
||||
title?: string;
|
||||
hp_max?: number;
|
||||
gp?: number;
|
||||
stats?: Record<string, number>;
|
||||
}
|
||||
|
||||
export const createCharacter = (campaignId: number, data: CreateCharacterData) =>
|
||||
request<Character>(`/campaigns/${campaignId}/characters`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(data),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue