107107 <div class =" text-center px-8 py-8 border-t border-gray-300 w-full" >
108108 <h1 class =" inline-block mr-3 font-bold text-gray-matcha leading-none" >Location</h1 >
109109 <h1 class =" text-md font-normal opacity-50 text-gray-matcha mx-auto pb-2 max-w-sm" >If you refused sharing location, it will be approximated from your computer address </h1 >
110- <h1 v-if =" !locationUpdateSuccess" class =" mx-auto onboarding-sub-container-content-button-outline max-w-sm border font-normal mt-2 px-2 cursor-pointer" v-on:click =" updateLocation()" >Update current location</h1 >
111- <h1 v-else class =" mx-auto onboarding-sub-container-content-button-outline max-w-sm border font-normal mt-2 px-2 cursor-pointer text-green-500" >Success</h1 >
110+ <h1 v-if =" !locationUpdateSuccess && !fetching" class =" mx-auto onboarding-sub-container-content-button-outline max-w-sm border font-normal mt-2 px-2 cursor-pointer" v-on:click =" updateLocation()" >Update current location</h1 >
111+ <h1 v-if =" locationUpdateSuccess && !fetching" class =" mx-auto onboarding-sub-container-content-button-outline max-w-sm border font-normal mt-2 px-2 cursor-pointer text-green-500" >Success</h1 >
112+ <div v-if =" fetching" class =" mx-auto flex items-center justify-center mt-4" >
113+ <img class =" h-12" src =" ../../assets/loading.svg" >
114+ </div >
112115 </div >
113116 <div class =" text-center py-8 w-full px-8 border-t border-gray-300" >
114117 <h1 class =" font-bold text-gray-matcha" >Images<span class =" text-md font-normal ml-2 opacity-50 text-gray-matcha" >{{this.$store.getters.getLoggedInUser.images.length}} / 5</span ></h1 >
@@ -161,6 +164,7 @@ export default {
161164 },
162165 locationUpdateSuccess: false ,
163166 settingsFetched: false ,
167+ fetching: false ,
164168 }),
165169 computed: {
166170 getShow () {
@@ -169,6 +173,7 @@ export default {
169173 },
170174 methods: {
171175 async updateLocation () {
176+ this .fetching = true ;
172177 navigator .geolocation .getCurrentPosition (
173178 this .locationAllowed ,
174179 this .locationDenied ,
@@ -180,6 +185,7 @@ export default {
180185 const { longitude } = position .coords ;
181186 const locationData = { lat: latitude, lng: longitude, ip: ' 0.0.0.0' };
182187 await this .$http .put (' /profile/edit/geolocation' , locationData);
188+ this .fetching = false ;
183189 this .locationUpdateSuccess = true ;
184190 setTimeout (() => {
185191 this .locationUpdateSuccess = false ;
@@ -191,6 +197,7 @@ export default {
191197 const { ip } = ipRequest;
192198 const locationData = { ip };
193199 await this .$http .put (' /profile/edit/geolocation' , locationData);
200+ this .fetching = false ;
194201 this .locationUpdateSuccess = true ;
195202 setTimeout (() => {
196203 this .locationUpdateSuccess = false ;
0 commit comments