matthew-andrews / isomorphic-fetch

Isomorphic WHATWG Fetch API, for Node & Browserify
MIT License
6.95k stars 288 forks source link

NO DELETE in isomorphic-fetch???? Is this possible??? #84

Closed jonnydungeons closed 8 years ago

jonnydungeons commented 8 years ago

I get this error and do not know what the deal is...

Fetch API cannot load http://localhost:3001/lob/delete/32c10308 Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. The response had HTTP status code 404. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. undefined:1 Uncaught (in promise) TypeError: Failed to fetch(…)

Just for some context here is my react code in my action: export function deleteLob(lobid) { return function(dispatch) { dispatch({ type: types.IGNITE_LOB_DELETE, lobid }) fetch(${config.SERVER_PREFIX}lob/delete/${lobid}, { method: 'DELETE' }) .then(function(response) { if (response.status >= 400) throw new Error("Bad response from server") //TODO: notification

            return 200
    })
}
elhamsarikhani commented 6 years ago

Why this issue is closed?

jonnydungeons commented 6 years ago

@elhamsarikhani - TBH, I figured out the issue.