Skip to content

Fix: Type-Safe API client - Incorrect HTTP method for update #118

@greenlover1991

Description

@greenlover1991

From

method: 'DELETE',

async update<T extends keyof C['collections']>({
    collection,
    data,
    ...toQs
  }: {
    collection: T;
    data: DeepPartial<C['collections'][T]>;
    depth?: number;
    draft?: boolean;
    fallbackLocale?: C['locale'];
    id: C['collections'][T]['id'];
    locale?: C['locale'];
    where: Where;
  }): Promise<BulkOperationResult<C['collections'][T]>> {
    const qs = buildQueryString(toQs);

    const response = await this.fetcher(`${this.apiURL}/${collection.toString()}${qs}`, {
      body: JSON.stringify(data),
      headers: {
        'Content-Type': 'application/json',
      },
      method: 'DELETE',
    });

    return response.json();
  }

Should be method: 'PATCH'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions