Skip to content

Commit

Permalink
Fix bug in resource collection
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-berezhnoy committed Dec 29, 2023
1 parent 40f31f0 commit e9976ad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/endpoints/rest/resource_collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ export class ResourceCollection<T> extends UpdatableCollection<T> {
protected async _insert(value: Partial<Omit<T, 'id'>> | any): Promise<any> {
const body = {};
body[this.resourceName] = value;
return await this.endpoint.fetchJson(this.getResourceListUrl(), 'POST', body);
return await this.endpoint.fetchJson(this.getResourceListUrl(), 'POST', { body });
}

public async update(value: Partial<Omit<T, 'id'>>, id: string): Promise<void> {
this.sendUpdateEvent(value, id);
const body = {};
body[this.resourceName] = value;
await this.endpoint.fetchJson(this.getResourceUrl(id), 'PUT', body);
await this.endpoint.fetchJson(this.getResourceUrl(id), 'PUT', { body });
}

public async upsert(value: Partial<Omit<T, 'id'>>, id: string): Promise<boolean> {
Expand Down

0 comments on commit e9976ad

Please sign in to comment.