0👍
You need to return the promise in your function to get the result in your locationData
variable
// In CommonMethod.js
export const getLocationData = async () => {
return navigator.geolocation.getCurrentPosition(
success => {
console.log("SUCCESS", success);
return success;
},
error => {
console.log("ERROR", error);
return error;
}
);
};
`
- [Vuejs]-Why trying to run Vue.js it does not work properly?
- [Vuejs]-Vue v-for doesn't update directly
Source:stackexchange.com