Function to perform a fetch request and return the response data.

If the URL is not provided, the fetch fails, or the response status is not ok.

  • Parameters

    • url: string

      The URL to fetch.

    • Optionaloptions: RequestInit = {}

      The options for the fetch request.

    Returns Promise<any>

    The response data.