Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(text => {
parser.parseString(text, (err, result) => {
if (err) {
console.warn(err);
dispatch(
requestNewsError({
title: "error",
detail: "can not get news"
})
);
} else {
dispatch(receiveNews(result.feed.entries));
}
});
})
.catch(error =>
}
if (!isRetry && resp.statusCode === 401 && hasRefreshToken) {
refreshOAuthToken(err => {
if (err) reject(new Response({statusCode: 401}));
else sendRequest(resolve, reject, true);
})
return;
} else if (resp.statusCode >= 300) {
return reject(new Response({statusCode: resp.statusCode, body}));
}
let ctype = resp.headers['content-type'] || '';
if (body && ctype.indexOf('application/json') !== -1) {
body = JSON.parse(body);
resolve(body);
} else if (openapi.info['x-datafire'] && openapi.info['x-datafire'].type === 'rss') {
rssParser.parseString(body, (err, feed) => {
if (err) reject(err);
else resolve(feed);
})
} else {
resolve(body);
}
})
}