Showing
4 changed files
with
8 additions
and
7 deletions
... | @@ -9,8 +9,8 @@ export const token = atom({ | ... | @@ -9,8 +9,8 @@ export const token = atom({ |
9 | effects_UNSTABLE : [persistAtom], | 9 | effects_UNSTABLE : [persistAtom], |
10 | }); | 10 | }); |
11 | 11 | ||
12 | -export const userType = atom({ | 12 | +export const userTypeCd = atom({ |
13 | - key : 'userType', | 13 | + key : 'userTypeCd', |
14 | default : 'NORMAL', | 14 | default : 'NORMAL', |
15 | effects_UNSTABLE : [persistAtom], | 15 | effects_UNSTABLE : [persistAtom], |
16 | }); | 16 | }); |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -18,7 +18,7 @@ const LoginContainer = (props : LoginProps) => { | ... | @@ -18,7 +18,7 @@ const LoginContainer = (props : LoginProps) => { |
18 | password : '', | 18 | password : '', |
19 | }); | 19 | }); |
20 | const [token, setToken] = useRecoilState(recoilUtil.token); | 20 | const [token, setToken] = useRecoilState(recoilUtil.token); |
21 | - const [userType, setUserType] = useRecoilState(recoilUtil.userType); | 21 | + const [userTypeCd, setUserTypeCd] = useRecoilState(recoilUtil.userTypeCd); |
22 | 22 | ||
23 | const onSetUserId = (e : React.ChangeEvent<HTMLInputElement>) => { | 23 | const onSetUserId = (e : React.ChangeEvent<HTMLInputElement>) => { |
24 | setLoginForm({ | 24 | setLoginForm({ |
... | @@ -39,6 +39,7 @@ const LoginContainer = (props : LoginProps) => { | ... | @@ -39,6 +39,7 @@ const LoginContainer = (props : LoginProps) => { |
39 | const result : any = await authApi.login(loginForm); | 39 | const result : any = await authApi.login(loginForm); |
40 | if(result.statusText === 'OK') { | 40 | if(result.statusText === 'OK') { |
41 | setToken(result.data.token); | 41 | setToken(result.data.token); |
42 | + setUserTypeCd(result.data.userTypeCd); | ||
42 | props.history.push('/'); | 43 | props.history.push('/'); |
43 | } | 44 | } |
44 | } catch(e) { | 45 | } catch(e) { | ... | ... |
... | @@ -14,7 +14,7 @@ type MainProps = RouteComponentProps | ... | @@ -14,7 +14,7 @@ type MainProps = RouteComponentProps |
14 | const MainContainer = (props : MainProps) => { | 14 | const MainContainer = (props : MainProps) => { |
15 | 15 | ||
16 | const token = useRecoilValue(recoilUtil.token); | 16 | const token = useRecoilValue(recoilUtil.token); |
17 | - const userType = useRecoilValue(recoilUtil.userType); | 17 | + const userTypeCd = useRecoilValue(recoilUtil.userTypeCd); |
18 | 18 | ||
19 | useEffect(() => { | 19 | useEffect(() => { |
20 | if(!token || !token.length) { | 20 | if(!token || !token.length) { |
... | @@ -24,7 +24,7 @@ const MainContainer = (props : MainProps) => { | ... | @@ -24,7 +24,7 @@ const MainContainer = (props : MainProps) => { |
24 | 24 | ||
25 | return ( | 25 | return ( |
26 | <MainPresenter | 26 | <MainPresenter |
27 | - userType = {userType} | 27 | + userTypeCd = {userTypeCd} |
28 | /> | 28 | /> |
29 | ); | 29 | ); |
30 | }; | 30 | }; | ... | ... |
... | @@ -4,13 +4,13 @@ import * as styled from './MainStyled'; | ... | @@ -4,13 +4,13 @@ import * as styled from './MainStyled'; |
4 | 4 | ||
5 | 5 | ||
6 | interface MainProps { | 6 | interface MainProps { |
7 | - userType : string; | 7 | + userTypeCd : string; |
8 | } | 8 | } |
9 | 9 | ||
10 | const MainPresenter = (props : MainProps) => { | 10 | const MainPresenter = (props : MainProps) => { |
11 | return ( | 11 | return ( |
12 | <styled.Container> | 12 | <styled.Container> |
13 | - This is Main Page {props.userType} | 13 | + This is Main Page {props.userTypeCd} |
14 | </styled.Container> | 14 | </styled.Container> |
15 | ) | 15 | ) |
16 | }; | 16 | }; | ... | ... |
-
Please register or login to post a comment