mirror of
https://github.com/Djeeberjr/fw-anwesenheit.git
synced 2025-07-01 16:54:17 +00:00
33 lines
580 B
TypeScript
33 lines
580 B
TypeScript
export interface IDMapping {
|
|
id_map: IDMap
|
|
}
|
|
|
|
export interface IDMap {
|
|
[name: string]: Name
|
|
}
|
|
|
|
export interface Name {
|
|
first: string,
|
|
last: string,
|
|
}
|
|
|
|
export async function addMapping(id: string, firstName: string, lastName: string) {
|
|
let req = await fetch("/api/mapping", {
|
|
method: "POST",
|
|
headers: {
|
|
"Content-type": "application/json; charset=UTF-8"
|
|
},
|
|
body: JSON.stringify({
|
|
id,
|
|
name: {
|
|
first: firstName,
|
|
lastName: lastName,
|
|
},
|
|
})
|
|
});
|
|
|
|
if (req.status != 200) {
|
|
console.error(await req.text())
|
|
}
|
|
}
|