mirror of
https://github.com/morbalint/kemkas.git
synced 2026-07-18 03:13:46 +00:00
636dcb92b3
not fully tested, but seems to work overall
33 lines
924 B
TypeScript
33 lines
924 B
TypeScript
import axios from "axios";
|
|
import {Karakter2E} from "../domain-models/karakter2E";
|
|
|
|
export async function StoreNewCharacter2E(karakter: Karakter2E, isPublic: boolean = false) {
|
|
let response = await axios.post(`${window.location.origin}/api/Character2E/`, karakter, {
|
|
withCredentials: true,
|
|
params: {
|
|
isPublic,
|
|
}
|
|
})
|
|
if (response.status < 300){
|
|
return response.data as string
|
|
}
|
|
else {
|
|
throw Error(response.statusText)
|
|
}
|
|
}
|
|
|
|
export async function UpdateCharacter2E(id: string, karakter: Karakter2E, isPublic: boolean = false) {
|
|
let response = await axios.post(`${window.location.origin}/api/Character2E/${id}`, karakter, {
|
|
withCredentials: true,
|
|
params: {
|
|
isPublic,
|
|
}
|
|
})
|
|
if (response.status < 300){
|
|
return response.data as string
|
|
}
|
|
else {
|
|
throw Error(response.statusText)
|
|
}
|
|
}
|