User bearbeiten fix
Noch ein fix
This commit is contained in:
parent
28f75bf88f
commit
471089fd19
@ -22,7 +22,7 @@ async function updateUser(uid, mid, name, picture, email) {
|
||||
}
|
||||
|
||||
async function realUpdateUser(uid, mid, name, picture, email){
|
||||
console.log("DBCONNECT UPDATE PIC: ", picture)
|
||||
console.log("DBCONNECT UPDATE PIC: ", picture, "UPDATENAME:", name)
|
||||
try {
|
||||
await nonQuery('Update "User" set message_id = $1, name = $2, picture = $3, email = $4 WHERE username = $5', [mid, name, picture, email, uid]);
|
||||
return 'done'
|
||||
|
@ -9,7 +9,6 @@ var config = {
|
||||
};
|
||||
firebase.initializeApp(config);
|
||||
|
||||
|
||||
async function checkAuth() {
|
||||
await firebase.auth().onAuthStateChanged(async function (user) {
|
||||
if (user) {
|
||||
@ -25,9 +24,7 @@ async function checkAuth() {
|
||||
}
|
||||
window.onload = function () {
|
||||
checkAuth();
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
var vue = new Vue({
|
||||
el: '#vue-app',
|
||||
@ -54,7 +51,6 @@ var vue = new Vue({
|
||||
var idToken = result.credential.idToken;
|
||||
// The signed-in user info.
|
||||
var user = result.user;
|
||||
console.log("Eingelogt");
|
||||
checkAuth();
|
||||
}).catch(function (error) {
|
||||
// Handle Errors here.
|
||||
@ -71,37 +67,9 @@ var vue = new Vue({
|
||||
firebase.auth().signInWithEmailAndPassword(this.email, this.password).then(result => {
|
||||
checkAuth();
|
||||
}).catch(function (error) {
|
||||
// Handle Errors here.
|
||||
var errorCode = error.code;
|
||||
var errorMessage = error.message;
|
||||
// ...
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
mounted() {
|
||||
/*axios.post('/user', {
|
||||
message_id: 'test',
|
||||
})
|
||||
.then(function (response) {
|
||||
console.log(response);
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
});*/
|
||||
}
|
||||
|
||||
// mounted() {
|
||||
// axios.post('/user', {
|
||||
// message_id: 'test',
|
||||
// })
|
||||
// .then(function (response) {
|
||||
// console.log(response);
|
||||
// })
|
||||
// .catch(function (error) {
|
||||
// console.log(error);
|
||||
// });
|
||||
// }
|
||||
|
||||
});
|
@ -27,8 +27,8 @@ var vue = new Vue({
|
||||
image: '',
|
||||
idToken: '',
|
||||
mid: '',
|
||||
showUploadButtons: ''
|
||||
|
||||
showUploadButtons: '',
|
||||
uploadfinish: false
|
||||
},
|
||||
methods: {
|
||||
backToDash(){
|
||||
@ -49,7 +49,7 @@ var vue = new Vue({
|
||||
vm.idToken = idToken;
|
||||
vm.mid = token;
|
||||
vm.dbUserUpdate(vm.idToken, vm.name, vm.image, vm.mid);
|
||||
window.location.href = "/";
|
||||
//window.location.href = "/";
|
||||
})
|
||||
.catch(err => {
|
||||
console.error("Msg Error: ", err);
|
||||
@ -57,7 +57,7 @@ var vue = new Vue({
|
||||
vm.mid = "";
|
||||
vm.dbUserUpdate(vm.idToken, vm.name, vm.image, vm.mid);
|
||||
|
||||
window.location.href = "/";
|
||||
//window.location.href = "/";
|
||||
})
|
||||
|
||||
}).catch(function (error) {
|
||||
@ -65,7 +65,7 @@ var vue = new Vue({
|
||||
});
|
||||
}else{
|
||||
this.dbUserUpdate(this.idToken, this.name, this.image, this.mid);
|
||||
window.location.href = "/";
|
||||
//window.location.href = "/";
|
||||
}
|
||||
|
||||
},
|
||||
@ -101,7 +101,6 @@ var vue = new Vue({
|
||||
displayName: name,
|
||||
photoURL: pic
|
||||
}).then(async function () {
|
||||
|
||||
}).catch(function (error) {
|
||||
console.error(error)
|
||||
});
|
||||
@ -117,6 +116,7 @@ var vue = new Vue({
|
||||
name: name
|
||||
},
|
||||
success(result) {
|
||||
vm.uploadfinish = true;
|
||||
//vm.startGetUser();
|
||||
},
|
||||
error(err) {
|
||||
@ -169,6 +169,7 @@ var vue = new Vue({
|
||||
}).catch(err => console.error(err));
|
||||
},
|
||||
onFileChange(e) {
|
||||
this.uploadfinish = false;
|
||||
var files = e.target.files || e.dataTransfer.files;
|
||||
if (!files.length)
|
||||
return;
|
||||
|
@ -25,6 +25,7 @@ router.post('/userbearbeiten', function (req, res, next) {
|
||||
var name = req.body.name;
|
||||
var pic = req.body.pic;
|
||||
var vm = this;
|
||||
console.log(req.body)
|
||||
firebaseAdmin.auth().verifyIdToken(token)
|
||||
.then(async function (decodedToken) {
|
||||
console.log("UID: ", decodedToken.uid);
|
||||
|
@ -27,12 +27,12 @@
|
||||
zu SmartShopper</button>
|
||||
<img v-bind:src="this.dataPic" width="100%" />
|
||||
<div class="mdl-card__title mdl-card--expand">
|
||||
{{name}}
|
||||
</div>
|
||||
<div class="mdl-card__actions">
|
||||
<label for="nameinput">Name: </label><input type="text" id="nameinput" v-model="name">
|
||||
<label for="nameinput">Name: </label><input type="text" id="nameinput" v-model="name" @click="uploadfinish = false">
|
||||
</div>
|
||||
<div class="mdl-card__actions mdl-card--border">
|
||||
|
||||
<div v-if="!showUploadButtons">
|
||||
<Label
|
||||
class="input-custom-file mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--colored">
|
||||
@ -52,7 +52,9 @@
|
||||
Foto setzten
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label v-show="uploadfinish" style="color:green;">Der User wurde erfolgreich gespeichert. Sie können wieder zu SmartShopper zurückkehren!</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</center>
|
||||
|
Loading…
x
Reference in New Issue
Block a user