diff --git a/client/src/app.js b/client/src/app.js index 04f2232..b8de3fe 100644 --- a/client/src/app.js +++ b/client/src/app.js @@ -47,7 +47,9 @@ const client_url = window.location.origin; // will be something like http://loca const server_url = client_url.substr(0, client_url.length-4) + config.server_port; // change from client_url to http://localhost:5000 // const server_url = 'http://0.0.0.0:' + config.server_port; // change from client_url to http://localhost:500 -const countrycode = config.country_code; +const shareable = config.can_share; +const saveable = config.can_save; + let KeplerGl; if (config.custom_header_path) { const CustomPanelHeaderFactory = () => CustomPanelHeader; @@ -203,28 +205,28 @@ class App extends Component { } exportMapConfig = () => { - let email = this.props.idToken ? this.props.idToken.email : 'default' - // create the config object - const mapConfig = this.getMapConfig(); - const url = '/api/maps/save/' + email; - // Sending and receiving data in JSON format using POST method - fetch(url, { - method: 'POST', - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json' - }, - body: JSON.stringify(mapConfig) - }) - .then(response => response.json()) - .then(body => alert(body.message)); - // // save it as a json file - // downloadJsonFile(mapConfig, 'kepler.gl.json'); + if (saveable) { + let email = this.props.idToken ? this.props.idToken.email : 'default' + // create the config object + const mapConfig = this.getMapConfig(); + const url = '/api/maps/save/' + email; + // Sending and receiving data in JSON format using POST method + fetch(url, { + method: 'POST', + headers: { + 'Accept': 'application/json', + 'Content-Type': 'application/json' + }, + body: JSON.stringify(mapConfig) + }) + .then(response => response.json()) + .then(body => alert(body.message)); + // // save it as a json file + }// downloadJsonFile(mapConfig, 'kepler.gl.json'); }; render() { const { width, height } = this.state; - const saveable = config.can_save; return (