made changes in profile picture in login

master
varun 3 years ago
parent a79616bbbf
commit e5b9b620bf

@ -210,17 +210,29 @@ fastify.post("/api/login", {
var stringToJsonObject = JSON.parse(arrayToString); // convert string to json object
var c_id = loginObject.user.customerId
var profilePicture = await ProfilePicture.findOne({ customerId:c_id});
// console.log({
// username: loginObject.user.username,
// roles: loginObject.user.profile.role,
// rolesasobj: stringToJsonObject,
// });
// console.log("sending token \n");
// console.log(token);
reply.send({
simplydata: {
error: false,
if (!profilePicture) {
reply.send({
simplydata: {
error: false,
apiversion: fastify.config.APIVERSION,
access_token: token,
email: loginObject.user.emails,
phone: loginObject.user.phone,
customerId: loginObject.user.customerId,
username: loginObject.user.username,
address1: loginObject.user.profile.address1,
address2: loginObject.user.profile.address2,
phoneVerified: loginObject.user.phoneVerified,
oneTimePasswordSetFlag: loginObject.user.oneTimePasswordSetFlag,
type: loginObject.user.profile.role,
typeasobj: stringToJsonObject,
},
});
}if (profilePicture) {
reply.send({
simplydata: {
error: false,
apiversion: fastify.config.APIVERSION,
access_token: token,
picture:profilePicture.picture,
@ -234,8 +246,18 @@ fastify.post("/api/login", {
oneTimePasswordSetFlag: loginObject.user.oneTimePasswordSetFlag,
type: loginObject.user.profile.role,
typeasobj: stringToJsonObject,
},
});
},
});
}
// console.log({
// username: loginObject.user.username,
// roles: loginObject.user.profile.role,
// rolesasobj: stringToJsonObject,
// });
// console.log("sending token \n");
// console.log(token);
}
} else {
error = {

Loading…
Cancel
Save