Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
A
Aqbits Trace Code
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mai Thanh Cong
Aqbits Trace Code
Commits
0cb0e999
Commit
0cb0e999
authored
Jul 07, 2021
by
Mai Thanh Cong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix router when login
parent
305100c1
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
125 additions
and
111 deletions
+125
-111
.env
.env
+1
-2
src/HomePage.js
src/HomePage.js
+91
-0
src/components/Navbars/DemoNavbar.js
src/components/Navbars/DemoNavbar.js
+12
-2
src/index.js
src/index.js
+9
-89
src/services/AuthServices.js
src/services/AuthServices.js
+5
-1
src/services/Lambda/ListNodeLambda.js
src/services/Lambda/ListNodeLambda.js
+0
-6
src/services/Lambda/NodeHistoryLambda.js
src/services/Lambda/NodeHistoryLambda.js
+0
-6
src/services/Signin.js
src/services/Signin.js
+7
-5
No files found.
.env
View file @
0cb0e999
#config
#config
REACT_APP_AWS_USER_POOL_ID = us-east-1_c1uad9xyt
REACT_APP_AWS_USER_POOL_ID = us-east-1_c1uad9xyt
REACT_APP_AWS_CLIENT_ID = 339mutkibblh97ojfjgti8gei7
REACT_APP_AWS_CLIENT_ID = 339mutkibblh97ojfjgti8gei7
REACT_APP_AQBITS_SERVER_URL = wss://ewcxwsv9hc.execute-api.us-east-1.amazonaws.com/development
REACT_APP_BASE_URL_AQBITS_TRACE_CODE = https://f26svz60d8.execute-api.us-east-1.amazonaws.com/api
REACT_APP_BASE_URL_AQBITS = https://wll3ump6p9.execute-api.us-east-1.amazonaws.com/api
\ No newline at end of file
\ No newline at end of file
src/HomePage.js
0 → 100644
View file @
0cb0e999
import
React
,
{
useState
,
useEffect
}
from
"
react
"
;
import
ReactDOM
from
"
react-dom
"
;
import
{
BrowserRouter
,
HashRouter
,
Route
,
Switch
,
Redirect
,
useHistory
}
from
"
react-router-dom
"
;
import
"
assets/vendor/nucleo/css/nucleo.css
"
;
import
"
assets/vendor/font-awesome/css/font-awesome.min.css
"
;
import
"
assets/scss/argon-design-system-react.scss?v1.1.0
"
;
import
AddProfile
from
"
./components/Profile/AddProfile
"
;
import
Index
from
"
views/Index.js
"
;
import
Landing
from
"
views/examples/Landing.js
"
;
import
Login
from
"
views/examples/Login.js
"
;
import
Profile
from
"
views/examples/Profile.js
"
;
import
Register
from
"
views/examples/Register.js
"
;
import
NotFound
from
"
views/examples/NotFound.js
"
import
DetailProfile
from
"
./components/Profile/DetailProfile.js
"
import
SearchProfile
from
"
./components/Profile/SearchProfile.js
"
;
import
Tracecode
from
"
./components/Profile/Tracecode.js
"
import
AddProduct
from
"
components/Profile/AddProduct
"
;
import
Signin
from
"
./services/Signin
"
;
import
Signup
from
"
services/Signup
"
;
import
{
authServices
}
from
"
./services/AuthServices
"
;
import
{
Routes
}
from
"
reoutes
"
;
// import { Routes } from "./reoutes";
const
RouteWithLoader
=
({
component
:
Component
,
...
rest
})
=>
{
return
(
<
Route
{...
rest
}
render
=
{
props
=>
authServices
.
isAuthenticated
()
===
true
?
<
Component
{...
props
}
/> : <Redirect to={{ pathname: '/
login
-
page
'
}} />} />
);
};
export default () => (
<Switch>
<Route exact path="/login-page" component={Signin} />
<RouteWithLoader exact path="/" component={SearchProfile} />
<RouteWithLoader exact path="/profile/add" component={AddProfile} />
<RouteWithLoader exact path="/profile/add-product" component={AddProduct} />
<RouteWithLoader exact path="/profile/:code" component={DetailProfile} />
<RouteWithLoader exact path="/trace-code/:trace" component={Tracecode} />
<RouteWithLoader exact path="/not-found" component={NotFound} />
{/* <Route path="/profile" exact render={props => <SearchProfile {...props} />} />
<Route
path="/profile/add"
exact
render={props => <AddProfile {...props} />}
/>
<Route
path="/profile/add-product"
exact
render={props => <AddProduct {...props} />}
/>
<Route
path="/trace-code/:trace"
exact
render={props => <Tracecode {...props} />}
/>
<Route
path="/profile/:code"
exact
render={props => <DetailProfile {...props} />}
/>
<Route
path="/not-found"
exact
render={props => <NotFound {...props} />}
/>
<Route
path="/landing-page"
exact
render={props => <Landing {...props} />}
/>
<Route
path="/signin"
exact
render={props => <Signin {...props} />} />
<Route
path="/profile-page"
exact
render={props => <Profile {...props} />}
/>
<Route
path="/signup"
exact
render={props => <Signup {...props} />}
/>
<Redirect to="/" /> */}
</Switch>
);
src/components/Navbars/DemoNavbar.js
View file @
0cb0e999
...
@@ -38,6 +38,7 @@ import {
...
@@ -38,6 +38,7 @@ import {
Col
,
Col
,
UncontrolledTooltip
UncontrolledTooltip
}
from
"
reactstrap
"
;
}
from
"
reactstrap
"
;
import
{
authServices
}
from
"
../../services/AuthServices
"
;
const
DemoNavbar
=
()
=>
{
const
DemoNavbar
=
()
=>
{
// componentDidMount() {
// componentDidMount() {
...
@@ -76,6 +77,11 @@ const DemoNavbar = () => {
...
@@ -76,6 +77,11 @@ const DemoNavbar = () => {
},
[]);
},
[]);
// render() {
// render() {
const
onHandleLogout
=
()
=>
{
authServices
.
logout
();
history
.
push
(
"
/login-page
"
);
}
return
(
return
(
<>
<>
...
@@ -197,12 +203,16 @@ const DemoNavbar = () => {
...
@@ -197,12 +203,16 @@ const DemoNavbar = () => {
<
DropdownItem
to
=
"
/login-page
"
tag
=
{
Link
}
>
<
DropdownItem
to
=
"
/login-page
"
tag
=
{
Link
}
>
Đă
ng
nh
ậ
p
Đă
ng
nh
ậ
p
<
/DropdownItem
>
<
/DropdownItem
>
<
DropdownItem
to
=
"
/register-page
"
tag
=
{
Link
}
>
{
/*
<DropdownItem to="/register-page" tag={Link}>
Đăng kí
Đăng kí
<
/DropdownItem
>
</DropdownItem>
*/
}
<
DropdownItem
to
=
"
/
"
tag
=
{
Link
}
>
<
DropdownItem
to
=
"
/
"
tag
=
{
Link
}
>
Tra
c
ứ
u
th
ô
ng
tin
Tra
c
ứ
u
th
ô
ng
tin
<
/DropdownItem
>
<
/DropdownItem
>
<
DropdownItem
divider
/>
<
DropdownItem
onClick
=
{
onHandleLogout
}
>
Đă
ng
xu
ấ
t
<
/DropdownItem
>
<
/DropdownMenu
>
<
/DropdownMenu
>
<
/UncontrolledDropdown
>
<
/UncontrolledDropdown
>
<
/Nav
>
<
/Nav
>
...
...
src/index.js
View file @
0cb0e999
/*!
import
React
from
'
react
'
;
import
ReactDOM
from
'
react-dom
'
;
import
{
HashRouter
}
from
"
react-router-dom
"
;
import
{
Provider
}
from
"
react-redux
"
;
=========================================================
// import store from "./store";
* Argon Design System React - v1.1.0
import
HomePage
from
"
./HomePage
"
;
=========================================================
* Product Page: https://www.creative-tim.com/product/argon-design-system-react
* Copyright 2020 Creative Tim (https://www.creative-tim.com)
* Licensed under MIT (https://github.com/creativetimofficial/argon-design-system-react/blob/master/LICENSE.md)
* Coded by Creative Tim
=========================================================
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/
import
React
from
"
react
"
;
import
ReactDOM
from
"
react-dom
"
;
import
{
BrowserRouter
,
Route
,
Switch
,
Redirect
}
from
"
react-router-dom
"
;
import
"
assets/vendor/nucleo/css/nucleo.css
"
;
import
"
assets/vendor/font-awesome/css/font-awesome.min.css
"
;
import
"
assets/scss/argon-design-system-react.scss?v1.1.0
"
;
import
AddProfile
from
"
./components/Profile/AddProfile
"
;
import
Index
from
"
views/Index.js
"
;
import
Landing
from
"
views/examples/Landing.js
"
;
import
Login
from
"
views/examples/Login.js
"
;
import
Profile
from
"
views/examples/Profile.js
"
;
import
Register
from
"
views/examples/Register.js
"
;
import
NotFound
from
"
views/examples/NotFound.js
"
import
DetailProfile
from
"
./components/Profile/DetailProfile.js
"
import
SearchProfile
from
"
./components/Profile/SearchProfile.js
"
;
import
Tracecode
from
"
./components/Profile/Tracecode.js
"
import
AddProduct
from
"
components/Profile/AddProduct
"
;
import
Signin
from
"
services/Signin
"
;
import
Signup
from
"
services/Signup
"
;
// import { Routes } from "./reoutes";
ReactDOM
.
render
(
ReactDOM
.
render
(
<
BrowserRouter
>
<
HashRouter
>
<
Switch
>
<
HomePage
/>
<
Route
path
=
"
/
"
exact
render
=
{
props
=>
<
SearchProfile
{...
props
}
/>} /
>
<
/HashRouter>
,
<
Route
path
=
"
/profile/add
"
exact
render
=
{
props
=>
<
AddProfile
{...
props
}
/>
}
/>
<
Route
path
=
"
/profile/add-product
"
exact
render
=
{
props
=>
<
AddProduct
{...
props
}
/>
}
/>
<
Route
path
=
"
/trace-code/:trace
"
exact
render
=
{
props
=>
<
Tracecode
{...
props
}
/>
}
/>
<
Route
path
=
"
/profile/:code
"
exact
render
=
{
props
=>
<
DetailProfile
{...
props
}
/>
}
/>
<
Route
path
=
"
/not-found
"
exact
render
=
{
props
=>
<
NotFound
{...
props
}
/>
}
/>
<
Route
path
=
"
/landing-page
"
exact
render
=
{
props
=>
<
Landing
{...
props
}
/>
}
/>
<
Route
path
=
"
/signin
"
exact
render
=
{
props
=>
<
Signin
{...
props
}
/>} /
>
<
Route
path
=
"
/profile-page
"
exact
render
=
{
props
=>
<
Profile
{...
props
}
/>
}
/>
<
Route
path
=
"
/signup
"
exact
render
=
{
props
=>
<
Signup
{...
props
}
/>
}
/>
<
Redirect
to
=
"
/
"
/>
<
/Switch
>
<
/BrowserRouter>
,
document
.
getElementById
(
"
root
"
)
document
.
getElementById
(
"
root
"
)
);
);
src/services/AuthServices.js
View file @
0cb0e999
...
@@ -143,7 +143,11 @@ export const authServices = {
...
@@ -143,7 +143,11 @@ export const authServices = {
});
});
},
},
isAuthenticated
:
()
=>
{
isAuthenticated
:
()
=>
{
return
localStorage
.
getItem
(
"
access_token
"
)
&&
localStorage
.
getItem
(
"
id_token
"
);
if
(
localStorage
.
getItem
(
"
access_token
"
)
&&
localStorage
.
getItem
(
"
id_token
"
)){
return
true
;
}
else
{
return
false
;
}
},
},
logout
:
()
=>
{
logout
:
()
=>
{
localStorage
.
removeItem
(
"
access_token
"
);
localStorage
.
removeItem
(
"
access_token
"
);
...
...
src/services/Lambda/ListNodeLambda.js
deleted
100644 → 0
View file @
305100c1
import
axiosClient
from
"
../NodeServices/index
"
;
const
END_POINT
=
"
https://v9f109ai6i.execute-api.us-east-1.amazonaws.com/development
"
;
export
const
getNodes
=
()
=>
axiosClient
.
get
(
END_POINT
);
src/services/Lambda/NodeHistoryLambda.js
deleted
100644 → 0
View file @
305100c1
import
axiosClient
from
"
../NodeServices/index
"
;
const
END_POINT
=
"
https://np23gd0j54.execute-api.us-east-1.amazonaws.com/development
"
;
export
const
getNodeHistory
=
(
param
)
=>
axiosClient
.
get
(
END_POINT
,
{
params
:
{
node_id
:
param
}
});
src/services/Signin.js
View file @
0cb0e999
...
@@ -26,6 +26,7 @@ import {
...
@@ -26,6 +26,7 @@ import {
// core components
// core components
import
DemoNavbar
from
"
components/Navbars/DemoNavbar.js
"
;
import
DemoNavbar
from
"
components/Navbars/DemoNavbar.js
"
;
import
SimpleFooter
from
"
components/Footers/SimpleFooter.js
"
;
import
SimpleFooter
from
"
components/Footers/SimpleFooter.js
"
;
import
MainBanner
from
"
components/Generals/MainBanner
"
;
export
default
()
=>
{
export
default
()
=>
{
...
@@ -49,7 +50,7 @@ export default () => {
...
@@ -49,7 +50,7 @@ export default () => {
authServices
authServices
.
login
(
email
,
password
)
.
login
(
email
,
password
)
.
then
((
rs
)
=>
{
.
then
((
rs
)
=>
{
history
.
push
(
Routes
.
Home
.
path
);
history
.
push
(
"
/profile
"
);
setCheckUser
(
false
);
setCheckUser
(
false
);
setLoading
(
false
);
setLoading
(
false
);
})
})
...
@@ -69,7 +70,7 @@ export default () => {
...
@@ -69,7 +70,7 @@ export default () => {
authServices
authServices
.
login
(
email
,
password
)
.
login
(
email
,
password
)
.
then
((
rs
)
=>
{
.
then
((
rs
)
=>
{
history
.
push
(
Routes
.
Home
.
path
);
history
.
push
(
"
/profile
"
);
setCheckUser
(
false
);
setCheckUser
(
false
);
setLoading
(
false
);
setLoading
(
false
);
})
})
...
@@ -83,8 +84,9 @@ export default () => {
...
@@ -83,8 +84,9 @@ export default () => {
return
(
return
(
<>
<>
<
DemoNavbar
/>
{
/* <DemoNavbar /> */
}
<
main
>
<
main
>
{
/* <MainBanner /> */
}
<
section
className
=
"
section section-shaped section-lg
"
>
<
section
className
=
"
section section-shaped section-lg
"
>
<
div
className
=
"
shape shape-style-1 bg-gradient-default
"
>
<
div
className
=
"
shape shape-style-1 bg-gradient-default
"
>
<
span
/>
<
span
/>
...
@@ -115,7 +117,7 @@ export default () => {
...
@@ -115,7 +117,7 @@ export default () => {
<
i
className
=
"
ni ni-email-83
"
/>
<
i
className
=
"
ni ni-email-83
"
/>
<
/InputGroupText
>
<
/InputGroupText
>
<
/InputGroupAddon
>
<
/InputGroupAddon
>
<
Input
placeholder
=
"
Email
"
type
=
"
email
"
<
Input
placeholder
=
"
Email
"
type
=
"
text
"
value
=
{
email
}
onChange
=
{(
e
)
=>
setEmail
(
e
.
target
.
value
)}
{...
validEmail
?
"
invalid
"
:
""
}
/
>
value
=
{
email
}
onChange
=
{(
e
)
=>
setEmail
(
e
.
target
.
value
)}
{...
validEmail
?
"
invalid
"
:
""
}
/
>
<
FormFeedback
valid
>
{
validEmail
}
<
/FormFeedback
>
<
FormFeedback
valid
>
{
validEmail
}
<
/FormFeedback
>
<
/InputGroup
>
<
/InputGroup
>
...
@@ -183,7 +185,7 @@ export default () => {
...
@@ -183,7 +185,7 @@ export default () => {
<
/Container
>
<
/Container
>
<
/section
>
<
/section
>
<
/main
>
<
/main
>
<
SimpleFooter
/>
{
/* <SimpleFooter /> */
}
<
/
>
<
/
>
);
);
};
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment