Modern React Template - v0.0.10
    Preparing search index...

    Function patchResource

    • Partially update an existing resource

      Sends a PATCH request to update only specified fields of a resource. Use PUT (updateResource) for complete replacement.

      Type Parameters

      • TInput

        Type of the input data

      • TOutput

        Type of the response data

      Parameters

      • url: string

        API endpoint URL including resource ID

      • data: Partial<TInput>

        Partial resource data to update

      Returns Promise<TOutput>

      Promise resolving to the updated resource

      const user = await patchResource<UserInput, User>('/api/users/123', {
      email: 'newemail@example.com' // Only update email
      });