Skip to content

Instantly share code, notes, and snippets.

@IPRIT
Last active April 27, 2020 19:05
Show Gist options
  • Select an option

  • Save IPRIT/9883188f19b1a1cc5555a0ea32025691 to your computer and use it in GitHub Desktop.

Select an option

Save IPRIT/9883188f19b1a1cc5555a0ea32025691 to your computer and use it in GitHub Desktop.
// src/store/rabota/search/actions.js:restoreQueryString
let location = state.location;
if (query[ 'subway_station' ] && getObjectValueByPath(state, 'location.subway_station.id') !== ensureNumber( query[ 'subway_station' ] )) {
location = {
subway_station: { id: ensureNumber( query[ 'subway_station' ] ) }
};
} else if (query[ 'location.latitude' ] && query[ 'location.longitude' ] && getObjectValueByPath(state, 'location.geopoint.latitude') !== ensureNumber( query[ 'location.latitude' ] ) && getObjectValueByPath(state, 'location.geopoint.longitude') !== ensureNumber( query[ 'location.longitude' ] )) {
location = {
geopoint: {
latitude: ensureNumber( query[ 'location.latitude' ] ),
longitude: ensureNumber( query[ 'location.longitude' ] ),
}
};
} else if (query[ 'region' ] && getObjectValueByPath(state, 'location.region.id') !== ensureNumber( query[ 'region' ] )) {
location = {
region: { id: ensureNumber( query[ 'region' ] ) }
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment