Last active
May 4, 2017 13:28
-
-
Save joedeveloper/136a22de0d2a235ca9cc3114c36e4376 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ar combinedQuery = gql `query get_users_me_reserve($url_name: String){ | |
reserve(url_name: $url_name){ | |
reserve | |
sponsored | |
} | |
users{_id profile{firstName,lastName,profilePicture,profileText,defaultColor}} | |
me{_id profile{firstName,lastName,profilePicture,profileText,defaultColor}} | |
}`; | |
const UglyMapWithData = graphql(combinedQuery, { | |
props: (props) => { | |
var newData = {}; | |
console.log('reserveQuery.config.props this: ', this); | |
console.log('reserveQuery.config.props props: ', props); | |
if(props.data.reserve){ | |
var data = props.data; | |
_.merge(newData, data); | |
newData.reserve.reserve = JSON.parse(data.reserve.reserve); | |
newData.reserve.sponsored = _.set(sponsored_grid_data, | |
'data.features',JSON.parse(data.reserve.sponsored)); | |
//data wrangling | |
var res, spon; | |
if((res = _.get(newData,'reserve.reserve')) && res.bounds){ | |
res.grid_data = createGrid(res.bounds); | |
res.center = turf.center(res.grid_data).geometry.coordinates; | |
res.grid_data = _.set(grid_data,'data', res.grid_data); | |
props.data = newData; | |
} | |
return props; | |
} | |
} | |
})(UglyMap); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment