Added handleCors URL parameter to turn off using cors-anywhere

This commit is contained in:
Przemek Wiech
2019-02-12 23:45:57 +01:00
parent e1ba96296a
commit 0d621c045b

View File

@@ -179,6 +179,7 @@ export class ChartView extends React.Component<RouteComponentProps, State> {
const parsedGen = Number(getParam('gen')); const parsedGen = Number(getParam('gen'));
const generation = !isNaN(parsedGen) ? parsedGen : undefined; const generation = !isNaN(parsedGen) ? parsedGen : undefined;
const hash = getParam('file'); const hash = getParam('file');
const handleCors = getParam('handleCors') !== 'false';
if (hash && hash !== this.state.hash) { if (hash && hash !== this.state.hash) {
// New "load from file" data. // New "load from file" data.
@@ -209,7 +210,7 @@ export class ChartView extends React.Component<RouteComponentProps, State> {
this.loadFromUrl(url, { this.loadFromUrl(url, {
indi, indi,
generation, generation,
handleCors: url.startsWith('http'), handleCors: url.startsWith('http') && handleCors,
}); });
} else if (!url && !gedcom && hash !== this.state.hash) { } else if (!url && !gedcom && hash !== this.state.hash) {
this.props.history.replace({pathname: '/'}); this.props.history.replace({pathname: '/'});