Error in Access to fetch at "xyz" url from origin 'https://localhost:3000' has been blocked by CORS policy

Viewed 20

Response to preflight request doesn't pass access control check: It does not have HTTP ok status.

PUT Function :

public createOrUpdateResource(path: string, type: string, data: Blob): Promise<Response> {
    return fetch(`${this.apiUrl}${path}`, {
      method: 'PUT',
      headers: this.createHeaders({
        'content-type': type,
      }),
      body: data,
    })

Above function returning correct response url which I am passing to below function to generate public url

public getpublicurl(href: string, abortController?: AbortController): Promise<Response> {
    return fetch(`${href}/assets/:link`, {
      method: 'GET',
      headers: this.createHeaders(),
      signal: abortController?.signal,
    })
  }

Error in above function.

0 Answers
Related