Replaced axios with fetch(). Added one more polyfill.

IE11 still does not work.
This commit is contained in:
Przemek Wiech 2019-02-07 01:26:25 +01:00
parent cb2fad4fcd
commit e1ba96296a
3 changed files with 11 additions and 6 deletions

View File

@ -3,7 +3,7 @@
"version": "1.0.0",
"main": "src/index.tsx",
"dependencies": {
"axios": "^0.18.0",
"array.prototype.find": "^2.0.4",
"d3": "^5.7.0",
"history": "^4.7.2",
"md5": "^2.2.1",

View File

@ -1,6 +1,5 @@
import * as queryString from 'query-string';
import * as React from 'react';
import axios from 'axios';
import md5 from 'md5';
import {Chart} from './chart';
import {convertGedcom} from './gedcom_util';
@ -103,11 +102,16 @@ export class ChartView extends React.Component<RouteComponentProps, State> {
? 'https://cors-anywhere.herokuapp.com/' + url
: url;
axios
.get(urlToFetch)
.then((response) =>
window.fetch(urlToFetch)
.then((response) => {
if (response.status !== 200) {
return Promise.reject(new Error(response.statusText));
}
return response.text();
})
.then((data) =>
this.setGedcom({
gedcom: response.data,
gedcom: data,
url,
indi: options.indi,
generation: options.generation,

View File

@ -1,5 +1,6 @@
import 'react-app-polyfill/ie11';
import 'string.prototype.startswith';
import 'array.prototype.find';
import * as locale_en from 'react-intl/locale-data/en';
import * as locale_pl from 'react-intl/locale-data/pl';
import * as React from 'react';