Skip to content

Commit c025f2e

Browse files
committed
success message on location change
1 parent 369e268 commit c025f2e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

frontend/src/views/app/Settings.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@
106106
<div class="text-center px-8 py-8 border-t border-gray-300 w-full">
107107
<h1 class="inline-block mr-3 font-bold text-gray-matcha leading-none">Location</h1>
108108
<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>
109-
<h1 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>
109+
<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>
110+
<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>
110111
</div>
111112
<div class="text-center py-8 w-full px-8 border-t border-gray-300">
112113
<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>
@@ -160,6 +161,7 @@ export default {
160161
image: {
161162
error: null,
162163
},
164+
locationUpdateSuccess: false,
163165
}),
164166
computed: {
165167
getShow() {
@@ -179,13 +181,21 @@ export default {
179181
const { longitude } = position.coords;
180182
const locationData = { lat: latitude, lng: longitude, ip: '0.0.0.0' };
181183
await this.$http.put('/profile/edit/geolocation', locationData);
184+
this.locationUpdateSuccess = true;
185+
setTimeout(() => {
186+
this.locationUpdateSuccess = false;
187+
}, 3000);
182188
},
183189
async locationDenied() {
184190
let ipRequest = await fetch('https://api.ipify.org?format=json');
185191
ipRequest = await ipRequest.json();
186192
const { ip } = ipRequest;
187193
const locationData = { ip };
188194
await this.$http.put('/profile/edit/geolocation', locationData);
195+
this.locationUpdateSuccess = true;
196+
setTimeout(() => {
197+
this.locationUpdateSuccess = false;
198+
}, 3000);
189199
},
190200
async selectFile() {
191201
this.image.error = '';

0 commit comments

Comments
 (0)