You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working on a location input. It gets the suggestions from Google Place API. I want to save 2 things in the database, the string value of the location (place) which is something like Manchester, NY, US and also a second meta field which is an object containing the details about the selected place.
As you can see I am checking for the option event via a plugin and then using the payload of that event, I initiate another async API call to get the details about the selected place, whenever that resolves, I update a ref which I have used as a v-model on the meta filed to set the value of it.
It kind of works but I have some questions and appreciate insights:
Do you see any issues with this approach?
What happens if the user selects and saves the form before the 2nd API call is resolved? Is there a way to disable the form while waiting for the 2nd API call? Is there a better way to do this?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am working on a location input. It gets the suggestions from Google Place API. I want to save 2 things in the database, the string value of the location (place) which is something like
Manchester, NY, US
and also a secondmeta
field which is an object containing the details about the selected place.I am using the pro autocomplete filed type for this and you can find a simplified version here:
Playground: https://formkit.link/d1a657c79fb713d95d4a9155bc6a7446
As you can see I am checking for the
option
event via aplugin
and then using the payload of that event, I initiate another async API call to get the details about the selected place, whenever that resolves, I update aref
which I have used as av-model
on themeta
filed to set the value of it.It kind of works but I have some questions and appreciate insights:
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions