Skip to content

Commit

Permalink
Merge pull request #215 from fdhhhdjd/developer
Browse files Browse the repository at this point in the history
#176 [Frontend] Student Full Authentication
  • Loading branch information
fdhhhdjd authored Mar 19, 2023
2 parents 0a95720 + 277ed09 commit f359144
Show file tree
Hide file tree
Showing 36 changed files with 380 additions and 135 deletions.
17 changes: 17 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//!@ Author: Nguyễn Tiến Tài.
//! Description: Setting Vs Code
//!@ Created_At : 19-03-2023.

{
"recommendations": [
"dbaeumer.vscode-eslint",
"editorconfig.editorconfig",
"xabikos.javascriptsnippets",
"stylelint.vscode-stylelint",
"fabiospampinato.vscode-highlight",
"dsznajder.es7-react-js-snippets",
"esbenp.prettier-vscode",
"ms-vscode.vscode-typescript-tslint-plugin",
"adpyke.vscode-sql-formatter"
]
}
32 changes: 28 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,43 @@
//"editor.formatOnSave": true sẽ kích hoạt chức năng tự động định dạng (format) mã nguồn khi lưu file.
//"editor.defaultFormatter": "esbenp.prettier-vscode" chỉ định sử dụng thư viện esbenp.prettier-vscode để định dạng mã nguồn.
//"editor.codeActionsOnSave": { "source.fixAll": true } sẽ kích hoạt chức năng tự động sửa lỗi khi lưu file.
//"files.eol": "\n" sẽ chỉ định ký tự kết thúc dòng là dấu xuống dòng (new line)
//!@ Author: Nguyễn Tiến Tài.
//! Description: Setting Vs Code
//!@ Created_At : 20-12-2022.
//!@ Update_At: 13-02-2023 19-03-2023

{
// Auto Format code
"editor.formatOnSave": true,

// Used Prettier format code
"editor.defaultFormatter": "esbenp.prettier-vscode",

// Update module import path when moving files.
"javascript.updateImportsOnFileMove.enabled": "always",

// Highlight brackets when the cursor is inside them
"editor.guides.bracketPairs": "active",

// Check syntax errors and errors in code with ESLint for JS and TS files.
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
],

// Automatically correct errors reported in the code when saving the file.
"editor.codeActionsOnSave": {
"source.fixAll": true
},

// Set the newline character for files to be a newline (LF).
"files.eol": "\n",

// Use Extendtion SQL as default code format for SQL files.
"[sql]": {
"editor.defaultFormatter": "adpyke.vscode-sql-formatter"
},

// cSpell spell check list of words to skip.
"cSpell.words": [
"argothim",
"Localstorage",
Expand Down
2 changes: 1 addition & 1 deletion frontend-manager-cms/nginx/default.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
server{
listen 3000;
listen 3001;

location / {
root /usr/share/nginx/html;
Expand Down
Empty file.
4 changes: 2 additions & 2 deletions frontend-manager-student/src/api/api_user.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ const API_STUDENT = {
* @created_at 10/03/2023
* @descriptionKey API GET ALL BOOK
*/
GET_ALL_BOOK_STUDENT: '/student/v1/user/private/book/all',
GET_ALL_BOOK_STUDENT: '/student/v1/user/book/all',

/**
* @author Châu Gia Bảo
* @created_at 10/03/2023
* @descriptionKey API GET DETAIL BOOK
*/
GET_DETAIL_BOOK_STUDENT: '/student/v1/user/private/book/detail',
GET_DETAIL_BOOK_STUDENT: '/student/v1/user/book/detail',

/**
* @author Châu Gia Bảo
Expand Down
3 changes: 3 additions & 0 deletions frontend-manager-student/src/components/BookCard.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
//! LIBRARY
import React from 'react';
import { Link } from 'react-router-dom';

//! COMPONENTS
import Button from './Button';

const BookCard = (props) => {
Expand Down
1 change: 1 addition & 0 deletions frontend-manager-student/src/components/Button.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//! LIBRARY
import React from 'react';
import PropTypes from 'prop-types';

Expand Down
1 change: 1 addition & 0 deletions frontend-manager-student/src/components/CategoryCard.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//! LIBRARY
import React from 'react';
import PropTypes from 'prop-types';

Expand Down
1 change: 1 addition & 0 deletions frontend-manager-student/src/components/Dropdown.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//! LIBRARY
import React, { useState } from 'react';
import { Form } from 'react-bootstrap';

Expand Down
1 change: 1 addition & 0 deletions frontend-manager-student/src/components/Filter.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//! LIBRARY
import React from 'react';

const Filter = () => {
Expand Down
7 changes: 6 additions & 1 deletion frontend-manager-student/src/components/Footer.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
//! LIBRARY
import React from 'react';
import { FB_LOGO, SCHOOL_LOGO, YTB_LOGO, ZL_LOGO } from '../imports/home_import/index';
import { Link } from 'react-router-dom';

//! IMPORT
import { FB_LOGO, SCHOOL_LOGO, YTB_LOGO, ZL_LOGO } from '../imports/home_import/index';

//! COMPONENTS
import Grid from './Grid';

const Footer = () => {
Expand Down
1 change: 1 addition & 0 deletions frontend-manager-student/src/components/Grid.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//! LIBRARY
import React from 'react';
import propTypes from 'prop-types';

Expand Down
1 change: 1 addition & 0 deletions frontend-manager-student/src/components/Helmet.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//! LIBRARY
import React, { useEffect } from 'react';
import propTypes from 'prop-types';

Expand Down
9 changes: 7 additions & 2 deletions frontend-manager-student/src/components/Layout.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import Header from 'components/Header';
import Login from 'pages/Auth/Login';
//! LIBRARY
import React, { useState } from 'react';

//! PAGE
import Login from 'pages/Auth/Login';
import Footer from './Footer';

//! COMPONENTS
import Header from 'components/Header';

const Layout = (props) => {
const [showLogin, setShowLogin] = useState(false);

Expand Down
9 changes: 8 additions & 1 deletion frontend-manager-student/src/components/Loading.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
//! LIBRARY
import React from 'react';

//! STYLE
import 'styles/components/_loading.scss';
const Loading = () => {
return <div>Loading....</div>;
return (
<>
<span className="loader"></span>
</>
);
};

export default Loading;
1 change: 1 addition & 0 deletions frontend-manager-student/src/components/NewsCard.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//! LIBRARY
import React from 'react';
import PropTypes from 'prop-types';

Expand Down
1 change: 1 addition & 0 deletions frontend-manager-student/src/components/Section.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//! LIBRARY
import React from 'react';
import { Link } from 'react-router-dom';

Expand Down
12 changes: 12 additions & 0 deletions frontend-manager-student/src/configs/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,17 @@ const CONSTANTS = {
PNG: 'image/png',
FILE: 'file',
},
/**
* @author Nguyễn Tiến Tài
* @created_at 15/03/2023
* @descriptionKey STATUS CODE
* @return {string}
*/
STATUS: {
_OK: 200,
_BAD_REQUEST: 400,
_UNAUTHORIZED: 401,
_NOT_FOUND: 404,
},
};
export default CONSTANTS;
23 changes: 21 additions & 2 deletions frontend-manager-student/src/configs/text_notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,34 @@ const TEXT_NOTIFICATION = {
* @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
* @description Text title web
*/
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_SEND_MAIL_SUCCESS: 'Gửi mail thành công',
NOTIFICATION_RESET_PASSWORD_SUCCESS: 'Reset password thành công',

NOTIFICATION_RESET: {
PASSWORD_SUCCESS_TITLE: 'Reset password thành công',
PASSWORD_SUCCESS_TEXT: 'Hãy quay về trang chủ để đăng nhập',
},

NOTIFICATION_FORGET_PASSWORD_SUCCESS:
'Đã gửi link reset password đến ${email}. Vui lòng vào email của bạn để tiếp tục',
NOTIFICATION_LOGIN_SESSION_EXPIRE: 'Phiên đăng nhập của bạn đã hết hạn',
/**
* @author Nguyễn Tiến Tài,Châu Gia Bảo
* @created_at 19/03/2023
* @description Text input
*/
NOTIFICATION_INPUT_INVALID: {
_EMAIL: 'Email Không được bỏ trống !!!',
_PHONE: 'Phone Không được bỏ trống !!!',
_FULL_NAME: 'Full Name Không được bỏ trống !!!',
_MSSV: 'MSSV Không được bỏ trống !!!',
},
};
export default TEXT_NOTIFICATION;
16 changes: 16 additions & 0 deletions frontend-manager-student/src/custom_hook/useNavigate/Navigate.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//! LIBRARY
import { useNavigate } from 'react-router-dom';

const Navigate = () => {
//Create navigate
const navigate = useNavigate();

// Handle change page
const navigateChangePage = (link) => {
navigate(link);
};

return { navigateChangePage };
};

export default Navigate;
8 changes: 5 additions & 3 deletions frontend-manager-student/src/imports/auth_import/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
//Change Password
// Change Password
export { default as TabChangePassword } from 'pages/Auth/ChangePassword/component/TabChangePassword';

//Login
// Login
export { default as TabLogin } from 'pages/Auth/Login/components/TabLogin';

//Forget
// Forget
export { default as TabForgetPassword } from 'pages/Auth/Login/components/TabForgetPassword';

// Reset
export { default as TabResetPassword } from 'pages/Auth/ResetPassword/components/TabResetPassword';
2 changes: 1 addition & 1 deletion frontend-manager-student/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import App from './App';
import reportWebVitals from './reportWebVitals';

//! COMPONENT
import RouterNprogress from 'components/Nprogress/RouterNprogress';
import RouterNprogress from 'plugins/Nprogress/RouterNprogress';

ReactDOM.render(
<Provider store={store}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useDispatch, useSelector } from 'react-redux';
//! SHARE
import HELPERS from 'utils/helper';
import NOTIFICATION from 'utils/notification';
import TEXT_NOTIFICATION from 'configs/text_notification';

//!REDUX THUNK
import { Forget_Password_Initial } from 'redux/student/authentication_slice/auth_thunk';
Expand All @@ -21,17 +22,22 @@ const TabForgetPassword = ({ setShowLogin, setForgetPage }) => {
}));

const handleForgetStudent = (e) => {
// PreventDefault Enter reload form
e.preventDefault();

// Take data form
const values = HELPERS.formDataGeneral(e.target);

//Check input
// Check input
if (!values.email) {
return NOTIFICATION.notifyError('Email Không được bỏ trống !!!');
return NOTIFICATION.notifyError(TEXT_NOTIFICATION.NOTIFICATION_INPUT_INVALID._EMAIL);
}

// Action Login
dispatch(Forget_Password_Initial(values));

// Clear form
HELPERS.delInputSuccess(e);
};
return (
<React.Fragment>
Expand Down
Loading

0 comments on commit f359144

Please sign in to comment.