Skip to content

Commit db06d21

Browse files
committed
modules version up
1 parent 518f154 commit db06d21

File tree

9 files changed

+2837
-3305
lines changed

9 files changed

+2837
-3305
lines changed

Diff for: client/package-lock.json

+2,420-2,614
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: client/package.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"dependencies": {
66
"antd": "^3.24.1",
7-
"axios": "^0.18.0",
7+
"axios": "^0.19.2",
88
"formik": "^1.5.8",
99
"moment": "^2.24.0",
1010
"react": "^16.8.6",
@@ -16,7 +16,9 @@
1616
"redux": "^4.0.0",
1717
"redux-promise": "^0.6.0",
1818
"redux-thunk": "^2.3.0",
19-
"yup": "^0.27.0"
19+
"yup": "^0.27.0",
20+
"core-js": "^3.6.4",
21+
"react-app-polyfill": "^1.0.6"
2022
},
2123
"scripts": {
2224
"start": "react-scripts start",
@@ -40,6 +42,6 @@
4042
]
4143
},
4244
"devDependencies": {
43-
"http-proxy-middleware": "^0.19.1"
45+
"http-proxy-middleware": "^1.0.3"
4446
}
4547
}

Diff for: client/src/components/App.js

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ import RegisterPage from "./views/RegisterPage/RegisterPage.js";
88
import NavBar from "./views/NavBar/NavBar";
99
import Footer from "./views/Footer/Footer"
1010

11+
//null Anyone Can go inside
12+
//true only logged in user can go inside
13+
//false logged in user can't go inside
14+
1115
function App() {
1216
return (
1317
<Suspense fallback={(<div>Loading...</div>)}>

Diff for: client/src/hoc/auth.js

+10-6
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,39 @@ import React, { useEffect } from 'react';
33
import { auth } from '../_actions/user_actions';
44
import { useSelector, useDispatch } from "react-redux";
55

6-
export default function (ComposedClass, reload, adminRoute = null) {
6+
export default function (SpecificComponent, option, adminRoute = null) {
77
function AuthenticationCheck(props) {
88

99
let user = useSelector(state => state.user);
1010
const dispatch = useDispatch();
1111

1212
useEffect(() => {
13-
13+
//To know my current status, send Auth request
1414
dispatch(auth()).then(response => {
15+
//Not Loggined in Status
1516
if (!response.payload.isAuth) {
16-
if (reload) {
17+
if (option) {
1718
props.history.push('/login')
1819
}
20+
//Loggined in Status
1921
} else {
22+
//supposed to be Admin page, but not admin person wants to go inside
2023
if (adminRoute && !response.payload.isAdmin) {
2124
props.history.push('/')
2225
}
26+
//Logged in Status, but Try to go into log in page
2327
else {
24-
if (reload === false) {
28+
if (option === false) {
2529
props.history.push('/')
2630
}
2731
}
2832
}
2933
})
30-
34+
3135
}, [])
3236

3337
return (
34-
<ComposedClass {...props} user={user} />
38+
<SpecificComponent {...props} user={user} />
3539
)
3640
}
3741
return AuthenticationCheck

Diff for: client/src/index.js

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
import 'react-app-polyfill/ie9';
2+
import 'react-app-polyfill/ie11';
3+
import 'core-js';
4+
15
import React from 'react';
26
import ReactDOM from 'react-dom';
37
import './index.css';

Diff for: client/src/setupProxy.js

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
const proxy = require("http-proxy-middleware");
1+
const { createProxyMiddleware } = require('http-proxy-middleware');
22

3-
module.exports = function(app) {
4-
5-
app.use(proxy("/api", { target: "http://localhost:5000/" }));
6-
7-
};
3+
module.exports = function (app) {
4+
app.use(
5+
'/api',
6+
createProxyMiddleware({
7+
target: 'http://localhost:5000',
8+
changeOrigin: true,
9+
})
10+
);
11+
};

0 commit comments

Comments
 (0)