0
fetch(BaseURL + type, {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer' + token
    }

}

When I use GET method it changes the method to OPTIONS. Works fine with Safari. Sometimes when I refresh the page, it shows GET method but most of the time it shows OPTIONS 200ok status and returns no data.

Anh Pham
  • 645
  • 6
  • 20

1 Answers1

-1

You are trying to make cross origin requests. Due to CORS, it first send options(preflight) request to check if cross origin requests allowed on server, if it returns 200 ok, then it should send next get request as well. http://restlet.com/company/blog/2016/09/27/how-to-fix-cors-problems/

crack_iT
  • 1,321
  • 2
  • 12
  • 15