-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#176 [Frontend] Student Full Authentication
- Loading branch information
Showing
33 changed files
with
491 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Run Frontend dev | ||
run-dev: | ||
npm run dev | ||
|
||
# Run Production | ||
run-product: | ||
npm start |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const TEXT_NOTIFICATION = { | ||
/** | ||
* @author Nguyễn Tiến Tài | ||
* @created_at 04/03/2023 | ||
* @description LOgin success | ||
*/ | ||
NOTIFICATION_LOGIN_SUCCESS: 'Login Student Success', | ||
}; | ||
export default TEXT_NOTIFICATION; |
31 changes: 31 additions & 0 deletions
31
frontend-manager-student/src/contexts/auth_student/auth_student.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//! LIBRARY | ||
import { useEffect } from 'react'; | ||
import { useDispatch } from 'react-redux'; | ||
|
||
//! SHARE | ||
import HELPERS from 'utils/helper'; | ||
import CONSTANTS from '../../configs/constants'; | ||
import { getToken } from '../../utils/auth'; | ||
|
||
//! REDUX THUNK | ||
import { Profile_Student_Initial } from '../../redux/student/authentication_slice/auth_thunk'; | ||
|
||
const AuthStudent = () => { | ||
// InitialState Action | ||
const dispatch = useDispatch(); | ||
|
||
// Get Token localStore | ||
const token_localStorage = getToken(CONSTANTS.AUTH_TOKEN); | ||
|
||
//Check Token | ||
const decodedToken = HELPERS.isTokenExpired(token_localStorage); | ||
|
||
useEffect(() => { | ||
if (token_localStorage && decodedToken) { | ||
dispatch(Profile_Student_Initial(token_localStorage)); | ||
} | ||
}, []); | ||
|
||
return {}; | ||
}; | ||
export default AuthStudent; |
Oops, something went wrong.