Repair user info avatar error

This commit is contained in:
Qolzam
2017-07-09 08:35:33 +04:30
parent a23a16ef03
commit f170c770b2
3 changed files with 60 additions and 41 deletions

View File

@@ -51,7 +51,8 @@ export var dbSignup = (user) => {
dispatch(globalActions.showNotificationRequest()) dispatch(globalActions.showNotificationRequest())
return firebaseAuth().createUserWithEmailAndPassword(user.email, user.password).then((signupResult) => { return firebaseAuth().createUserWithEmailAndPassword(user.email, user.password).then((signupResult) => {
firebaseRef.child(`users/${signupResult.uid}/info`).set({ firebaseRef.child(`users/${signupResult.uid}/info`).set({
...user ...user,
avatar:'noImage'
}).then((result) => { }).then((result) => {
dispatch(globalActions.showNotificationSuccess()) dispatch(globalActions.showNotificationSuccess())

View File

@@ -24,7 +24,13 @@ export const dbGetUserInfo = () => {
return userInfoRef.once('value').then((snapshot) => { return userInfoRef.once('value').then((snapshot) => {
var userInfo = snapshot.val() || {}; var userInfo = snapshot.val() || {};
dispatch(addUserInfo(uid,userInfo)) dispatch(addUserInfo(uid, {
avatar: userInfo.avatar,
email: userInfo.email,
fullName: userInfo.fullName,
banner: userInfo.banner,
tagLine: userInfo.tagLine
}))
}, error => console.log(error)); }, error => console.log(error));
} }
@@ -42,7 +48,13 @@ export const dbGetUserInfoByUserId = (uid,sw) => {
return userInfoRef.once('value').then((snapshot) => { return userInfoRef.once('value').then((snapshot) => {
var userInfo = snapshot.val() || {}; var userInfo = snapshot.val() || {};
dispatch(addUserInfo(uid,userInfo)) dispatch(addUserInfo(uid, {
avatar: userInfo.avatar,
email: userInfo.email,
fullName: userInfo.fullName,
banner: userInfo.banner,
tagLine: userInfo.tagLine
}))
switch (sw) { switch (sw) {
case 'header': case 'header':
dispatch(globalActions.setHeaderTitle(userInfo.fullName)) dispatch(globalActions.setHeaderTitle(userInfo.fullName))
@@ -103,9 +115,15 @@ export const dbGetPeopleInfo = () => {
let parsedPeople = {}; let parsedPeople = {};
Object.keys(people).forEach((userId) => { Object.keys(people).forEach((userId) => {
if (userId !== uid) { if (userId !== uid) {
let userInfo = people[userId].info
parsedPeople[userId] = { parsedPeople[userId] = {
...people[userId].info avatar: userInfo.avatar,
}} email: userInfo.email,
fullName: userInfo.fullName,
banner: userInfo.banner,
tagLine: userInfo.tagLine
}
}
}) })
dispatch(addPeopleInfo(parsedPeople)) dispatch(addPeopleInfo(parsedPeople))

View File

@@ -6,7 +6,7 @@
width: 200px; width: 200px;
position: fixed!important; position: fixed!important;
z-index: 1; z-index: 1;
overflow: auto overflow: hidden;
} }
.sidebar__large { .sidebar__large {