Parse xml
This commit is contained in:
parent
c3a818ffbb
commit
b822b7aad1
|
@ -23025,8 +23025,7 @@
|
|||
"sax": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
|
||||
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==",
|
||||
"dev": true
|
||||
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw=="
|
||||
},
|
||||
"saxes": {
|
||||
"version": "3.1.11",
|
||||
|
@ -26491,6 +26490,20 @@
|
|||
"integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==",
|
||||
"dev": true
|
||||
},
|
||||
"xml2js": {
|
||||
"version": "0.4.23",
|
||||
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz",
|
||||
"integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==",
|
||||
"requires": {
|
||||
"sax": ">=0.6.0",
|
||||
"xmlbuilder": "~11.0.0"
|
||||
}
|
||||
},
|
||||
"xmlbuilder": {
|
||||
"version": "11.0.1",
|
||||
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz",
|
||||
"integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA=="
|
||||
},
|
||||
"xmlchars": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz",
|
||||
|
|
|
@ -45,7 +45,8 @@
|
|||
"react-redux": "^7.1.1",
|
||||
"redux": "^4.0.4",
|
||||
"redux-thunk": "^2.3.0",
|
||||
"styled-components": "^4.3.2"
|
||||
"styled-components": "^4.3.2",
|
||||
"xml2js": "^0.4.23"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.6.0",
|
||||
|
|
|
@ -11,17 +11,30 @@ import { PlanetaryService } from "@Services";
|
|||
import { IHomePage } from "@Interfaces";
|
||||
// #endregion Interface Imports
|
||||
|
||||
var parseString = require('xml2js').parseString;
|
||||
|
||||
const CORS_PROXY = "https://cors-fix.status.im/";
|
||||
|
||||
const embarkBlog = "https://framework.embarklabs.io/atom.xml";
|
||||
|
||||
let embarkData = '';
|
||||
let parsedData:any = [];
|
||||
|
||||
export const FetchEmbark = () => {
|
||||
fetch(`${CORS_PROXY}`+ `${embarkBlog}`)
|
||||
.then(response => response.text())
|
||||
.then(data => {
|
||||
embarkData = data
|
||||
parseString(embarkData, function (err:any, result:any) {
|
||||
const entries = result.feed.entry;
|
||||
entries.forEach(entry => {
|
||||
const category = entry.category[0]['$']['term']
|
||||
if (category === 'tutorials') {
|
||||
parsedData.push(entry)
|
||||
}
|
||||
})
|
||||
});
|
||||
console.log(parsedData)
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -54,7 +67,6 @@ export const HomeActions = {
|
|||
dispatch: Dispatch
|
||||
) => {
|
||||
await FetchEmbark();
|
||||
console.log(embarkData)
|
||||
dispatch({
|
||||
payload: {
|
||||
embarkData: embarkData,
|
||||
|
|
Loading…
Reference in New Issue