Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2021-1-capstone-design1
/
RIT_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
박권수
2021-08-17 02:47:12 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
65d47040c638981a2305a06658114c2197624747
65d47040
1 parent
57810b68
feat. login api edit
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
7 deletions
web/src/util/recoilUtil.ts
web/src/views/login/LoginContainer.tsx
web/src/views/main/MainContainer.tsx
web/src/views/main/MainPresenter.tsx
web/src/util/recoilUtil.ts
View file @
65d4704
...
...
@@ -9,8 +9,8 @@ export const token = atom({
effects_UNSTABLE
:
[
persistAtom
],
});
export
const
userType
=
atom
({
key
:
'userType'
,
export
const
userType
Cd
=
atom
({
key
:
'userType
Cd
'
,
default
:
'NORMAL'
,
effects_UNSTABLE
:
[
persistAtom
],
});
\ No newline at end of file
...
...
web/src/views/login/LoginContainer.tsx
View file @
65d4704
...
...
@@ -18,7 +18,7 @@ const LoginContainer = (props : LoginProps) => {
password : '',
});
const [token, setToken] = useRecoilState(recoilUtil.token);
const [userType
, setUserType] = useRecoilState(recoilUtil.userType
);
const [userType
Cd, setUserTypeCd] = useRecoilState(recoilUtil.userTypeCd
);
const onSetUserId = (e : React.ChangeEvent<HTMLInputElement>) => {
setLoginForm({
...
...
@@ -39,6 +39,7 @@ const LoginContainer = (props : LoginProps) => {
const result : any = await authApi.login(loginForm);
if(result.statusText === 'OK') {
setToken(result.data.token);
setUserTypeCd(result.data.userTypeCd);
props.history.push('/');
}
} catch(e) {
...
...
web/src/views/main/MainContainer.tsx
View file @
65d4704
...
...
@@ -14,7 +14,7 @@ type MainProps = RouteComponentProps
const MainContainer = (props : MainProps) => {
const token = useRecoilValue(recoilUtil.token);
const userType
= useRecoilValue(recoilUtil.userType
);
const userType
Cd = useRecoilValue(recoilUtil.userTypeCd
);
useEffect(() => {
if(!token || !token.length) {
...
...
@@ -24,7 +24,7 @@ const MainContainer = (props : MainProps) => {
return (
<MainPresenter
userType
= {userType
}
userType
Cd = {userTypeCd
}
/>
);
};
...
...
web/src/views/main/MainPresenter.tsx
View file @
65d4704
...
...
@@ -4,13 +4,13 @@ import * as styled from './MainStyled';
interface MainProps {
userType : string;
userType
Cd
: string;
}
const MainPresenter = (props : MainProps) => {
return (
<styled.Container>
This is Main Page {props.userType}
This is Main Page {props.userType
Cd
}
</styled.Container>
)
};
...
...
Please
register
or
login
to post a comment