Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed 25: Second patch - make 'Share' and 'Save config' optional in ./client/config.js #27

Merged
merged 2 commits into from
Nov 18, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 21 additions & 19 deletions client/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 (
<GlobalStyleDiv>
<div
Expand Down