holy ravioli

This commit is contained in:
Laurent
2025-03-20 17:36:46 +01:00
parent fd7bdace3b
commit 609ef2b705
28 changed files with 245 additions and 93 deletions

View File

@@ -23,8 +23,22 @@ export class EventRequests {
let url = this.formatUrl([this.baseUrl, this.endpoints.EVENTS, token]);
return fetch(url)
.then(response => response.json())
.then(data => {
return new EventDto(data.name, data.token, data.dates)
})
.catch(error => console.error(error));
}
public async createEvent(event : EventDto){
let url = this.formatUrl([this.baseUrl, this.endpoints.CREATE]);
return fetch(url, {
method: "POST",
body : JSON.stringify(event)
})
.then(response => response.json())
.then(data => new EventDto(data.name, data.token, data.attendees))
.catch(error => console.error(error));
}
}