-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
19,706 additions
and
16,512 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,39 @@ | ||
import React, { useContext, useEffect } from 'react'; | ||
import { useHistory } from 'react-router-dom'; | ||
import Cookies from 'js-cookie'; | ||
import { mainContext } from 'reducer'; | ||
|
||
const AccountLock = () => { | ||
const { dispatch, state } = useContext(mainContext); | ||
const history = useHistory(); | ||
|
||
const { theme } = state; | ||
const lockAccount = e => { | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
e.nativeEvent.stopImmediatePropagation(); | ||
|
||
let NODE_URL = localStorage.getItem('NODE_URL') | ||
? localStorage.getItem('NODE_URL') | ||
: 'http://localhost:5001'; | ||
Cookies.remove(NODE_URL); | ||
history.push('/login'); | ||
}; | ||
|
||
useEffect(() => { | ||
if (theme === 'dark') { | ||
document.documentElement.classList.add('dark'); | ||
} else { | ||
document.documentElement.classList.remove('dark'); | ||
} | ||
}, [theme]); | ||
|
||
return ( | ||
<button onClick={lockAccount} className="ml-2 round-btn theme-round-btn "> | ||
{theme === 'light' && <img src={require(`assets/img/lock.svg`).default} alt="" />} | ||
{theme === 'dark' && <img src={require(`assets/img/lock-dark.svg`).default} alt="" />} | ||
</button> | ||
); | ||
}; | ||
|
||
export default AccountLock; |
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
Oops, something went wrong.