Skip to content

Commit 22a8166

Browse files
supalarrySeluj78
authored andcommitted
settings image upload loading icon
1 parent 0acc543 commit 22a8166

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

frontend/src/views/app/Settings.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,13 @@
118118
<div class="auth-sub-container-error mt-8" v-if="image.error">
119119
<h1 class="auth-sub-container-error-message">{{image.error}}</h1>
120120
</div>
121-
<button v-if="this.$store.getters.getLoggedInUser.images.length < 6" class="overflow-hidden relative onboarding-sub-container-content-button-outline border w-full max-w-sm my-4">
121+
<button v-if="this.$store.getters.getLoggedInUser.images.length < 5 && !fetchingImages" class="overflow-hidden relative onboarding-sub-container-content-button-outline border w-full max-w-sm my-4">
122122
<input style="padding-left: 100%;" class="cursor-pointer opacity-0 absolute top-0 left-0 w-full h-full rounded-md" type="file" v-on:change="selectFile()" ref="file">
123123
<img src="../../assets/onboarding/cloudPurple.png" class="w-8 mx-auto">
124124
</button>
125+
<div v-if="fetchingImages" class="mx-auto flex items-center justify-center mt-4">
126+
<img class="h-12" src="../../assets/loading.svg">
127+
</div>
125128
<ProfileImage
126129
v-for="image in this.$store.getters.getLoggedInUser.images"
127130
:key="image.id"
@@ -165,6 +168,7 @@ export default {
165168
locationUpdateSuccess: false,
166169
settingsFetched: false,
167170
fetching: false,
171+
fetchingImages: false,
168172
}),
169173
computed: {
170174
getShow() {
@@ -205,6 +209,7 @@ export default {
205209
},
206210
async selectFile() {
207211
this.image.error = '';
212+
this.fetchingImages = true;
208213
const allowedTypes = ['image/jpeg', 'image/png', 'image/gif'];
209214
const file = this.$refs.file.files[0];
210215
@@ -225,6 +230,7 @@ export default {
225230
}
226231
const user = await this.$http.get(`/users/${this.$store.getters.getLoggedInUser.id}`);
227232
await this.$store.dispatch('login', user.data);
233+
this.fetchingImages = false;
228234
},
229235
async deleteImage(...args) {
230236
const [imageId] = args;

0 commit comments

Comments
 (0)