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){
|
async function realUpdateUser(uid, mid, name, picture, email){
|
||||||
console.log("DBCONNECT UPDATE PIC: ", picture)
|
console.log("DBCONNECT UPDATE PIC: ", picture, "UPDATENAME:", name)
|
||||||
try {
|
try {
|
||||||
await nonQuery('Update "User" set message_id = $1, name = $2, picture = $3, email = $4 WHERE username = $5', [mid, name, picture, email, uid]);
|
await nonQuery('Update "User" set message_id = $1, name = $2, picture = $3, email = $4 WHERE username = $5', [mid, name, picture, email, uid]);
|
||||||
return 'done'
|
return 'done'
|
||||||
|
@ -9,7 +9,6 @@ var config = {
|
|||||||
};
|
};
|
||||||
firebase.initializeApp(config);
|
firebase.initializeApp(config);
|
||||||
|
|
||||||
|
|
||||||
async function checkAuth() {
|
async function checkAuth() {
|
||||||
await firebase.auth().onAuthStateChanged(async function (user) {
|
await firebase.auth().onAuthStateChanged(async function (user) {
|
||||||
if (user) {
|
if (user) {
|
||||||
@ -25,9 +24,7 @@ async function checkAuth() {
|
|||||||
}
|
}
|
||||||
window.onload = function () {
|
window.onload = function () {
|
||||||
checkAuth();
|
checkAuth();
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var vue = new Vue({
|
var vue = new Vue({
|
||||||
el: '#vue-app',
|
el: '#vue-app',
|
||||||
@ -54,7 +51,6 @@ var vue = new Vue({
|
|||||||
var idToken = result.credential.idToken;
|
var idToken = result.credential.idToken;
|
||||||
// The signed-in user info.
|
// The signed-in user info.
|
||||||
var user = result.user;
|
var user = result.user;
|
||||||
console.log("Eingelogt");
|
|
||||||
checkAuth();
|
checkAuth();
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
// Handle Errors here.
|
// Handle Errors here.
|
||||||
@ -71,37 +67,9 @@ var vue = new Vue({
|
|||||||
firebase.auth().signInWithEmailAndPassword(this.email, this.password).then(result => {
|
firebase.auth().signInWithEmailAndPassword(this.email, this.password).then(result => {
|
||||||
checkAuth();
|
checkAuth();
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
// Handle Errors here.
|
|
||||||
var errorCode = error.code;
|
var errorCode = error.code;
|
||||||
var errorMessage = error.message;
|
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: '',
|
image: '',
|
||||||
idToken: '',
|
idToken: '',
|
||||||
mid: '',
|
mid: '',
|
||||||
showUploadButtons: ''
|
showUploadButtons: '',
|
||||||
|
uploadfinish: false
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
backToDash(){
|
backToDash(){
|
||||||
@ -49,7 +49,7 @@ var vue = new Vue({
|
|||||||
vm.idToken = idToken;
|
vm.idToken = idToken;
|
||||||
vm.mid = token;
|
vm.mid = token;
|
||||||
vm.dbUserUpdate(vm.idToken, vm.name, vm.image, vm.mid);
|
vm.dbUserUpdate(vm.idToken, vm.name, vm.image, vm.mid);
|
||||||
window.location.href = "/";
|
//window.location.href = "/";
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.error("Msg Error: ", err);
|
console.error("Msg Error: ", err);
|
||||||
@ -57,7 +57,7 @@ var vue = new Vue({
|
|||||||
vm.mid = "";
|
vm.mid = "";
|
||||||
vm.dbUserUpdate(vm.idToken, vm.name, vm.image, vm.mid);
|
vm.dbUserUpdate(vm.idToken, vm.name, vm.image, vm.mid);
|
||||||
|
|
||||||
window.location.href = "/";
|
//window.location.href = "/";
|
||||||
})
|
})
|
||||||
|
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
@ -65,7 +65,7 @@ var vue = new Vue({
|
|||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
this.dbUserUpdate(this.idToken, this.name, this.image, this.mid);
|
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,
|
displayName: name,
|
||||||
photoURL: pic
|
photoURL: pic
|
||||||
}).then(async function () {
|
}).then(async function () {
|
||||||
|
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
});
|
});
|
||||||
@ -117,6 +116,7 @@ var vue = new Vue({
|
|||||||
name: name
|
name: name
|
||||||
},
|
},
|
||||||
success(result) {
|
success(result) {
|
||||||
|
vm.uploadfinish = true;
|
||||||
//vm.startGetUser();
|
//vm.startGetUser();
|
||||||
},
|
},
|
||||||
error(err) {
|
error(err) {
|
||||||
@ -169,6 +169,7 @@ var vue = new Vue({
|
|||||||
}).catch(err => console.error(err));
|
}).catch(err => console.error(err));
|
||||||
},
|
},
|
||||||
onFileChange(e) {
|
onFileChange(e) {
|
||||||
|
this.uploadfinish = false;
|
||||||
var files = e.target.files || e.dataTransfer.files;
|
var files = e.target.files || e.dataTransfer.files;
|
||||||
if (!files.length)
|
if (!files.length)
|
||||||
return;
|
return;
|
||||||
|
@ -25,6 +25,7 @@ router.post('/userbearbeiten', function (req, res, next) {
|
|||||||
var name = req.body.name;
|
var name = req.body.name;
|
||||||
var pic = req.body.pic;
|
var pic = req.body.pic;
|
||||||
var vm = this;
|
var vm = this;
|
||||||
|
console.log(req.body)
|
||||||
firebaseAdmin.auth().verifyIdToken(token)
|
firebaseAdmin.auth().verifyIdToken(token)
|
||||||
.then(async function (decodedToken) {
|
.then(async function (decodedToken) {
|
||||||
console.log("UID: ", decodedToken.uid);
|
console.log("UID: ", decodedToken.uid);
|
||||||
|
@ -27,12 +27,12 @@
|
|||||||
zu SmartShopper</button>
|
zu SmartShopper</button>
|
||||||
<img v-bind:src="this.dataPic" width="100%" />
|
<img v-bind:src="this.dataPic" width="100%" />
|
||||||
<div class="mdl-card__title mdl-card--expand">
|
<div class="mdl-card__title mdl-card--expand">
|
||||||
{{name}}
|
|
||||||
</div>
|
</div>
|
||||||
<div class="mdl-card__actions">
|
<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>
|
||||||
<div class="mdl-card__actions mdl-card--border">
|
<div class="mdl-card__actions mdl-card--border">
|
||||||
|
|
||||||
<div v-if="!showUploadButtons">
|
<div v-if="!showUploadButtons">
|
||||||
<Label
|
<Label
|
||||||
class="input-custom-file mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--colored">
|
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
|
Foto setzten
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</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>
|
||||||
</div>
|
</div>
|
||||||
</center>
|
</center>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user