Skip to content
Snippets Groups Projects
Commit dbb65b50 authored by Taneli Riihimäki's avatar Taneli Riihimäki
Browse files

mocking data WIP af

parent 7397406a
No related branches found
No related tags found
1 merge request!21Development
......@@ -25,8 +25,8 @@ class UserMap extends Component {
geometry: {
type: "Point",
coordinates: [
null,
null
62.2416479,
25.7597186
]
}
}]
......@@ -37,10 +37,15 @@ class UserMap extends Component {
}
componentDidMount(){
console.log(JSON.stringify(this.state.marker))
this.getCurrentPosition((position) => {
this.setCurrentPosition(position);
});
console.log(JSON.stringify(this.state.marker))
//sendGeoJSON()
}
// Sends the players marker to the backend
sendGeoJSON(){
fetch('http://localhost:5000/mapmarkers/insertLocation', {
method: 'PUT',
headers: {
......@@ -54,6 +59,7 @@ class UserMap extends Component {
.then(result => console.log(result))
}
componentWillUnmount(){
if(this.watchPositionId != null){
navigator.geolocation.clearWatch(this.watchPositionId);
......@@ -78,6 +84,7 @@ class UserMap extends Component {
]
}
});
console.log(this.state.marker)
}
getCurrentPosition(callback){
......@@ -118,6 +125,26 @@ class UserMap extends Component {
return JSON.stringify(geoJSON);
}
mockGeoJSON(){
return (JSON.stringify({
type: "FeatureCollection",
latitude: "",
longitude: "",
timestamp: "",
features: [{
type: "Feature",
properties: {},
geometry: {
type: "Point",
coordinates: [
62.2416479,
25.7597186
]
}
}]
}))
}
render() {
return (
<Map className='map' center={this.props.position} zoom={this.props.zoom}>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment