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
|
// Characters
|
||||||
export const getCharacters = (campaignId: number) =>
|
export const getCharacters = (campaignId: number) =>
|
||||||
request<Character[]>(`/campaigns/${campaignId}/characters`);
|
request<Character[]>(`/campaigns/${campaignId}/characters`);
|
||||||
export const createCharacter = (
|
export interface CreateCharacterData {
|
||||||
campaignId: number,
|
name: string;
|
||||||
data: { name: string; class?: string; ancestry?: string; hp_max?: number },
|
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`, {
|
request<Character>(`/campaigns/${campaignId}/characters`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify(data),
|
body: JSON.stringify(data),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue