Skip to content

Extend options to add additional metadata? #103

@crotanite

Description

@crotanite

Sometimes I would like to handle certain responses for requests in a certain way, such as a 422 returning pop up notifications with the errors. But I don't want to do this for ALL requests, so was wondering if there was a way to pass additional options such as "metadata" which can then be checked.

const useAPIFetch = $fetch.create({
  async onResponseError({ request, response, options }) {
    if(options.metadata.showPopUps) {
      // show popup
    }
  },
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions