Closed dave-burke closed 3 years ago
The OpenWeather API has a location query endpoint that takes comma delimited city, state, country, so there's no reason for us to do this kind of parsing.
This is being replaced by another story to implement more robust location picking like in the mock up.
The main input for the "one-call" API from OpenWeatherMap is lat/lon coordinates, so that's what we should consider the canonical location.
Storing the city/state is just for user-friendly display.
Tasks
location.stateCode
tostore.ts
.state
object to addstateCode
tolocation
.src/store/types.ts
as well.SET_STATE_CODE
mutation tostore/mutations.ts
and a matching function in thestore.ts
mutations: { }
section.LocationPicker.setCity
, if the new value contains a comma, callcity.split(',')
and store the first value aslocation.city
(per current behavior) and the second aslocation.stateCode
in the store (using the newSET_STATE_CODE
mutation). Both values should be trimmed of surrounding whitespace (probably in the store mutation functions).