File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change 1- import React from 'react' ;
1+ import React , { useState , useEffect } from 'react' ;
22import { useSelector , shallowEqual } from 'react-redux' ;
33
44import { useFormatMessage } from 'hooks' ;
@@ -8,12 +8,18 @@ import ChangePassword from './ChangePassword';
88
99const Profile = ( ) => {
1010 const { userData } = useSelector (
11- state => ( {
12- userData : state . auth . userData
11+ ( state ) => ( {
12+ userData : state . auth . userData ,
1313 } ) ,
1414 shallowEqual
1515 ) ;
1616
17+ const [ profile , setProfile ] = useState ( userData ) ;
18+
19+ useEffect ( ( ) => {
20+ setProfile ( userData ) ;
21+ } , [ userData ] ) ;
22+
1723 return (
1824 < >
1925 < section className = "hero is-hero-bar" >
@@ -22,7 +28,13 @@ const Profile = () => {
2228 </ div >
2329 </ section >
2430 < section className = "section is-main-section" >
25- < UserForm isEditing isProfile userData = { userData } action = { modifyUser } />
31+ < UserForm
32+ isEditing
33+ isProfile
34+ user = { profile }
35+ setUser = { setProfile }
36+ action = { modifyUser }
37+ />
2638 < ChangePassword />
2739 </ section >
2840 </ >
You can’t perform that action at this time.
0 commit comments