Showing
2 changed files
with
7 additions
and
6 deletions
| ... | @@ -6,12 +6,12 @@ import { | ... | @@ -6,12 +6,12 @@ import { |
| 6 | setBJID, | 6 | setBJID, |
| 7 | getPROFILE, | 7 | getPROFILE, |
| 8 | syncBJID, | 8 | syncBJID, |
| 9 | + initializeProfile, | ||
| 9 | } from '../../modules/profile'; | 10 | } from '../../modules/profile'; |
| 10 | import SettingForm from '../../components/setting/SettingForm'; | 11 | import SettingForm from '../../components/setting/SettingForm'; |
| 11 | import { sync } from '../../../node_modules/fast-glob/index'; | 12 | import { sync } from '../../../node_modules/fast-glob/index'; |
| 12 | const SettingContainer = ({ history }) => { | 13 | const SettingContainer = ({ history }) => { |
| 13 | const dispatch = useDispatch(); | 14 | const dispatch = useDispatch(); |
| 14 | - const [error, setError] = useState(null); | ||
| 15 | const { user, profile } = useSelector(({ user, profile }) => ({ | 15 | const { user, profile } = useSelector(({ user, profile }) => ({ |
| 16 | user: user.user, | 16 | user: user.user, |
| 17 | profile: profile, | 17 | profile: profile, |
| ... | @@ -42,11 +42,12 @@ const SettingContainer = ({ history }) => { | ... | @@ -42,11 +42,12 @@ const SettingContainer = ({ history }) => { |
| 42 | }; | 42 | }; |
| 43 | 43 | ||
| 44 | useEffect(() => { | 44 | useEffect(() => { |
| 45 | - console.log('1'); | 45 | + let username = user.username; |
| 46 | - let username = JSON.parse(user).username; | ||
| 47 | dispatch(getPROFILE({ username })); | 46 | dispatch(getPROFILE({ username })); |
| 48 | - //Do Init Form | 47 | + return () => { |
| 49 | - }, [dispatch]); | 48 | + dispatch(initializeProfile()); |
| 49 | + }; | ||
| 50 | + }, [dispatch, user]); | ||
| 50 | 51 | ||
| 51 | return ( | 52 | return ( |
| 52 | <SettingForm | 53 | <SettingForm | ... | ... |
| ... | @@ -22,7 +22,7 @@ const [ | ... | @@ -22,7 +22,7 @@ const [ |
| 22 | SYNC_BJID_SUCCESS, | 22 | SYNC_BJID_SUCCESS, |
| 23 | SYNC_BJID_FAILURE, | 23 | SYNC_BJID_FAILURE, |
| 24 | ] = createRequestActionTypes('profile/SYNC_BJID'); | 24 | ] = createRequestActionTypes('profile/SYNC_BJID'); |
| 25 | - | 25 | +export const initializeProfile = createAction(INITIALIZE); |
| 26 | export const syncBJID = createAction(SYNC_BJID, ({ username }) => ({ | 26 | export const syncBJID = createAction(SYNC_BJID, ({ username }) => ({ |
| 27 | username, | 27 | username, |
| 28 | })); | 28 | })); | ... | ... |
-
Please register or login to post a comment