removed equality warning

This commit is contained in:
mmacierzanka committed 2021-10-03 16:42:56 +02:00
1 parent 4b1ecdf9a2
commit 0d40279ae3
1 file changed
+3 -3
+3 -3
View File
@@ -7,15 +7,15 @@ export class APIClient {
if (typeof dbUrl !== "string") throw new Error("Database URL is not a string");
this.#dbUrl = dbUrl;
}
async updateEvents() {
async getEvents() {
const rq = await axios.get(`${this.#dbUrl}/api/getEvents`);
if (rq.status !== 200) throw new Error(`Request failed with status code ${rq.status}: ${rq.statusText}`);
return rq.data;
}
async getEvent(id) {
if (typeof id !== "string") throw new TypeError("Invalid ID type");
const events = await this.updateEvents();
return events.find((e) => e.id == id) ?? null;
const events = await this.getEvents();
return events.find((e) => e.id === id) ?? null;
}
async createEvent(data) {
return;