User bearbeiten fix

This commit is contained in:
Georg Reisinger
2019-03-24 16:26:02 +01:00
parent 187f81842e
commit d06c57701b
2 changed files with 11 additions and 9 deletions

View File

@ -25,12 +25,15 @@ var vue = new Vue({
dataPic: '',
image: '',
idToken: '',
mid: ''
mid: '',
showUploadButtons: ''
},
methods: {
fertig(){
this.dbUserUpdate(this.idToken, name, this.dataPic, this.mid);
this.dbUserUpdate(this.idToken, name, this.image, this.mid);
this.image = '';
this.startGetUser();
},
updateUser(){
console.log("updateuser")
@ -47,20 +50,18 @@ var vue = new Vue({
console.log("Zugriff auf msg", token, this.name, vm.dataPic);
vm.idToken = idToken;
vm.mid = token;
vm.image = '';
})
.catch(err => {
console.error("Msg Error: ", err);
vm.idToken = idToken;
vm.mid = "";
vm.image = '';
})
}).catch(function (error) {
console.error("Get id token client error: ", error)
});
this.showUploadButtons = '';
},
dbUserUpdate(token, name, pic, mid){
console.log("dbuserupdate: ", token, "\nname", name,"\npic: ", pic, "\nMId: ", mid)
@ -119,6 +120,7 @@ var vue = new Vue({
var vm = this;
var currentUser = firebase.auth().currentUser;
var uid = currentUser.uid;
this.dataPic = this.image;
var uploadTask = storage.ref('/').child(uid).putString(this.image, 'data_url', {contentType:'image/jpeg'});
uploadTask.on(firebase.storage.TaskEvent.STATE_CHANGED, // or 'state_changed'
function(snapshot) {
@ -143,7 +145,6 @@ var vue = new Vue({
}
console.log("download Url", downloadURL)
vm.image = downloadURL;
vm.dataPic = downloadURL;
vm.updateUser();
});
},
@ -171,6 +172,7 @@ var vue = new Vue({
reader.onload = (e) => {
vm.dataPic = e.target.result;
vm.image = e.target.result;
this.showUploadButtons = 'true';
};
reader.readAsDataURL(file);
},