Skip to content

Commit e12b8c0

Browse files
committed
WIP updateprofile
1 parent 9d56719 commit e12b8c0

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

src/components/auth/UpdateProfile.vue

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
<v-text-field v-model="Profile.displayName" label="Full name"></v-text-field>
1515
<v-text-field v-model="selectedPhoto.name" label="Avatar" prepend-icon='attach_file' @click="$refs.avatar.click()"></v-text-field>
1616
<input type="file" style="display: none" ref="avatar" accept="image/*" @change="getFile">
17-
1817
</div>
1918
</v-card-title>
2019
<v-card-actions>
@@ -69,7 +68,6 @@ export default {
6968
methods: {
7069
getFile (e) {
7170
this.selectedPhoto = e.target.files[0]
72-
console.log(this.selectedPhoto)
7371
},
7472
updateAvatar () {
7573
if (!this.selectedPhoto) {
@@ -80,27 +78,24 @@ export default {
8078
this.$storage.upload({
8179
ref: `/images/${name}`,
8280
file: this.selectedPhoto,
83-
progress: snapshot => {},
81+
progress: snapshot => { },
8482
error: err => {
8583
this.message = err.message
8684
this.snackbar = true
8785
},
8886
completed: downloadURL => {
8987
this.updateProfilePicture(downloadURL)
9088
.then(() => {
91-
console.log("profile updated")
92-
this.synchronize()
93-
console.log(this.$auth.user())
94-
this.message = 'Your avatar has been updated'
95-
this.snackbar = true
96-
this.selectedPhoto = { name: "" }
97-
this.ready = false;
89+
this.message = 'Your profile info has been updated'
90+
this.snackbar = true
91+
this.selectedPhoto = { name: "" }
92+
this.ready = false
9893
}).catch(error => {
99-
this.message = error.message;
94+
this.message = error.message
10095
this.snackbar = true
10196
})
10297
}
103-
});
98+
})
10499
},
105100
updateProfilePicture (fileName) {
106101
return this.$auth.updateProfilePicture(fileName)
@@ -111,19 +106,15 @@ export default {
111106
.user()
112107
.updateProfile(this.Profile.toJson())
113108
.then(() => {
114-
this.snackbar = true
115-
this.message = 'You have updated your profile successfully'
116-
this.ready = false
109+
if (this.selectedPhoto.type != undefined) {
110+
this.updateAvatar()
111+
}
117112
})
118113
.catch(error => {
119114
this.message = error.message
120115
this.snackbar = true
121116
this.ready = false
122117
});
123-
124-
if (this.selectedPhoto.type != undefined) {
125-
this.updateAvatar()
126-
}
127118
},
128119
synchronize () {
129120
this.Profile.setPhotoURL(this.$auth.user().photoURL)

0 commit comments

Comments
 (0)