Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#176 [Frontend] Student Full Authentication #207

Merged
merged 1 commit into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 67 additions & 46 deletions frontend-manager-student/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions frontend-manager-student/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"jwt-decode": "^3.1.2",
"moment": "^2.29.1",
"nanoid": "^4.0.1",
"nprogress": "^0.2.0",
"react": "^17.0.2",
"react-bootstrap": "^2.7.2",
"react-countup": "^6.1.1",
Expand All @@ -29,6 +30,7 @@
"react-facebook-login": "^4.1.1",
"react-google-login": "^5.2.2",
"react-google-recaptcha": "^2.1.0",
"react-helmet-async": "^1.3.0",
"react-hot-toast": "^2.2.0",
"react-icons": "^4.3.1",
"react-lazy-load-image-component": "^1.5.5",
Expand All @@ -44,8 +46,7 @@
"sass": "^1.57.1",
"sass-loader": "^13.2.0",
"slick-carousel": "^1.8.1",
"sweetalert": "^2.1.2",
"sweetalert2": "^11.4.8",
"sweetalert2": "^11.7.3",
"toast": "^0.3.47",
"uuid": "^8.3.2",
"web-vitals": "^1.0.1"
Expand Down
15 changes: 15 additions & 0 deletions frontend-manager-student/src/api/api_media.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const API_MEDIA = {
/**
* @author Nguyễn Tiến Tài
* @created_at 15/03/2023
* @descriptionKey API Upload Media
*/
UPLOAD_MEDIA: '/media/v1/media/private/upload',
/**
* @author Nguyễn Tiến Tài
* @created_at 15/03/2023
* @descriptionKey API Remove Media
*/
REMOVE_MEDIA: '/media/v1/media/private/remove',
};
export default API_MEDIA;
16 changes: 14 additions & 2 deletions frontend-manager-student/src/api/api_user.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ const API_STUDENT = {
* @descriptionKey API login student
*/
LOGIN_STUDENT: '/student/v1/user/login',
/**
* @author Nguyễn Tiến Tài
* @created_at 15/03/2023
* @descriptionKey API change password student
*/
CHANGE_PASSWORD_STUDENT: '/student/v1/user/private/change-password',
/**
* @author Nguyễn Tiến Tài
* @created_at 16/03/2023
* @descriptionKey API forget password student
*/
FORGET_PASSWORD_STUDENT: '/student/v1/user/forget-password',
/**
* @author Nguyễn Tiến Tài
* @created_at 03/03/2023
Expand Down Expand Up @@ -33,14 +45,14 @@ const API_STUDENT = {
/**
* @author Châu Gia Bảo
* @created_at 10/03/2023
* @descriptionKey API GET ALL BOOK
* @descriptionKey API GET DETAIL BOOK
*/
GET_DETAIL_BOOK_STUDENT: '/student/v1/user/private/book/detail',

/**
* @author Châu Gia Bảo
* @created_at 10/03/2023
* @descriptionKey API GET ALL BOOK
* @descriptionKey API GET BORROW BOOK
*/
BORROW_BOOK_STUDENT: '/student/v1/user/private/borrow_book/borrow',
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//!LIBRARY
import NProgress from 'nprogress';
import { useEffect } from 'react';
import { useLocation } from 'react-router-dom';

const RouterNprogress = () => {
const location = useLocation();

useEffect(() => {
const unlisten = () => {
NProgress.start();
};

return unlisten;
}, [location]);

useEffect(() => {
NProgress.done();
});

return null;
};

export default RouterNprogress;
16 changes: 14 additions & 2 deletions frontend-manager-student/src/configs/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const CONSTANTS = {
* @description millisecond/ second
* @return {Number}
*/
_2_SECOND: 2 * 1000,
_1_MINUTES: 60 * 1000,
_5_MINUTES: 5 * 60 * 1000,
_4_MINUTES: 4 * 60 * 1000,
Expand Down Expand Up @@ -67,17 +68,28 @@ const CONSTANTS = {
* @author Nguyễn Tiến Tài
* @created_at 02/03/2023
* @descriptionKey Key Auth token localStorage
* @return {Number}
* @return {string}
*/
AUTH_TOKEN: 'auth-token',
/**
* @author Nguyễn Tiến Tài
* @created_at 04/03/2023
* @descriptionKey Header
* @return {Number}
* @return {string}
*/
OS_TYPE_HEADER: 'web',
OS_VERSION_HEADER: '1.0',
APP_VERSION_HEADER: '1.0',
/**
* @author Nguyễn Tiến Tài
* @created_at 15/03/2023
* @descriptionKey TYPE MEDIA
* @return {string}
*/
MEDIA_TYPE: {
JPEG: 'image/jpeg',
PNG: 'image/png',
FILE: 'file'
}
};
export default CONSTANTS;
6 changes: 5 additions & 1 deletion frontend-manager-student/src/configs/text_notification.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
const TEXT_NOTIFICATION = {
/**
* @author Nguyễn Tiến Tài
* @author Nguyễn Tiến Tài,Châu Gia Bảo
* @created_at 04/03/2023
* @updated_at 15/03/2023,16/03/2023
* @description LOgin success
*/
NOTIFICATION_LOGIN_SUCCESS: 'Đăng nhập thành công',
NOTIFICATION_LOGOUT_SUCCESS: 'Đăng xuất thành công',
NOTIFICATION_CHANGE_PASSWORD_SUCCESS: 'Đổi mật khẩu thành công',
NOTIFICATION_FORGET_PASSWORD_SUCCESS: 'Đã gửi link reset password đến ${email}',
NOTIFICATION_LOGIN_SESSION_EXPIRE: 'Phiên đăng nhập của bạn đã hết hạn',
};
export default TEXT_NOTIFICATION;
Loading