Skip to content

Commit bb8e622

Browse files
committed
primary image change is public
1 parent ad62677 commit bb8e622

File tree

1 file changed

+11
-0
lines changed
  • frontend/src/components/app/users

1 file changed

+11
-0
lines changed

frontend/src/components/app/users/User.vue

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ export default {
3535
goBack() {
3636
this.$router.go(-1);
3737
},
38+
sortImages() {
39+
const userImagesLength = this.user.images.length;
40+
for (let i = 0; i < userImagesLength; i += 1) {
41+
if (this.user.images[i].is_primary && i !== 0) {
42+
this.user.images.splice(0, 0, this.user.images[i]);
43+
this.user.images.splice(i + 1, 1);
44+
return;
45+
}
46+
}
47+
},
3848
},
3949
watch: {
4050
async $route() {
@@ -46,6 +56,7 @@ export default {
4656
try {
4757
const userRequest = await this.$http.get(`/profile/view/${this.$route.params.id}`, { accessTokenRequired: true });
4858
this.user = userRequest.data.profile;
59+
this.sortImages();
4960
} catch (error) {
5061
this.error = error.response.data.error.message;
5162
}

0 commit comments

Comments
 (0)