openreplay/frontend/app/services/CustomEventService.ts
2024-08-29 10:24:07 +05:30

28 lines
842 B
TypeScript

import BaseService from './BaseService';
export default class CustomEventService extends BaseService {
async fetchAll(params: {}): Promise<[]> {
return this.client.get('/custom-events', params)
.then(r => r.json()).then(j => j.data);
}
async create(data: {}): Promise<{}> {
return this.client.post('/custom-events', data)
.then(r => r.json()).then(j => j.data);
}
async update(data: {}): Promise<{}> {
return this.client.put(`/custom-events/${data.id}`, data)
.then(r => r.json()).then(j => j.data);
}
async delete(id: string): Promise<{}> {
return this.client.delete(`/custom-events/${id}`)
.then(r => r.json()).then(j => j.data);
}
async fetchOne(id: string): Promise<{}> {
return this.client.get(`/custom-events/${id}`)
.then(r => r.json()).then(j => j.data);
}
}