Skip to content

Commit 590ece8

Browse files
authored
Merge pull request #44 from CreateThrive/hotfix/auth-update-user-data
Issue for modify user profile
2 parents 68de970 + 08de948 commit 590ece8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/state/actions/users.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { toastr } from 'react-redux-toastr';
44
import axios from 'utils/axios';
55
import { firebaseError } from 'utils';
66
import firebase from 'firebase.js';
7-
import { checkUserData } from './auth';
7+
import { checkUserData, AUTH_UPDATE_USER_DATA } from './auth';
88

99
export const USERS_FETCH_DATA_INIT = createAction('USERS_FETCH_DATA_INIT');
1010
export const USERS_FETCH_DATA_SUCCESS = createAction(
@@ -264,6 +264,12 @@ export const modifyUser = ({
264264
.ref(`users/${id}`)
265265
.update(userData);
266266

267+
const { uid } = firebase.auth().currentUser;
268+
269+
if (id === uid) {
270+
dispatch(AUTH_UPDATE_USER_DATA({ ...userData, id }));
271+
}
272+
267273
try {
268274
await Promise.all([deleteLogoTask, uploadLogoTask, updateUserDbTask]);
269275
} catch (error) {

0 commit comments

Comments
 (0)