mirror of
https://github.com/strapi/strapi.git
synced 2025-11-03 03:17:11 +00:00
Fix CORS issue
This commit is contained in:
parent
ceac222cb6
commit
4875649bc7
File diff suppressed because one or more lines are too long
@ -11,7 +11,6 @@ function* getVideos() {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
mode: 'no-cors',
|
||||
},
|
||||
false,
|
||||
true,
|
||||
|
||||
@ -9,7 +9,6 @@ import auth from 'utils/auth';
|
||||
* @return {object} The parsed JSON from the request
|
||||
*/
|
||||
function parseJSON(response) {
|
||||
// return response;
|
||||
return response.json ? response.json() : response;
|
||||
}
|
||||
|
||||
@ -21,7 +20,7 @@ function parseJSON(response) {
|
||||
* @return {object|undefined} Returns either the response, or throws an error
|
||||
*/
|
||||
function checkStatus(response, checkToken = true) {
|
||||
if (response.status >= 200 && response.status < 300) {
|
||||
if ((response.status >= 200 && response.status < 300) || response.status === 0) {
|
||||
return response;
|
||||
}
|
||||
|
||||
@ -155,7 +154,7 @@ export default function request(...args) {
|
||||
if (options && options.body && stringify) {
|
||||
options.body = JSON.stringify(options.body);
|
||||
}
|
||||
|
||||
|
||||
return fetch(url, options)
|
||||
.then(checkStatus)
|
||||
.then(parseJSON)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user