diff options
| author | Nidboj132 <lol2s@vp.plm> | 2023-07-12 17:58:04 +0200 |
|---|---|---|
| committer | Nidboj132 <lol2s@vp.plm> | 2023-07-12 17:58:04 +0200 |
| commit | 26cdd0d363b1e279b14f7c5c3c12bb7d5e6d87d8 (patch) | |
| tree | 548bd55dca7c3b1ae3ef86036b2eef3ec361b455 /frontend/src/components/login.js | |
| parent | login (diff) | |
| download | lphub-26cdd0d363b1e279b14f7c5c3c12bb7d5e6d87d8.tar.gz lphub-26cdd0d363b1e279b14f7c5c3c12bb7d5e6d87d8.tar.bz2 lphub-26cdd0d363b1e279b14f7c5c3c12bb7d5e6d87d8.zip | |
summary
Diffstat (limited to '')
| -rw-r--r-- | frontend/src/components/login.js | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/frontend/src/components/login.js b/frontend/src/components/login.js index 7bff5f0..204007f 100644 --- a/frontend/src/components/login.js +++ b/frontend/src/components/login.js | |||
| @@ -7,8 +7,8 @@ import img2 from "../imgs/10.png" | |||
| 7 | import img3 from "../imgs/11.png" | 7 | import img3 from "../imgs/11.png" |
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | export default function Login() { | 10 | export default function Login(prop) { |
| 11 | 11 | const {token,setToken} = prop | |
| 12 | function login() { | 12 | function login() { |
| 13 | window.location.href="https://lp.ardapektezol.com/api/v1/login" | 13 | window.location.href="https://lp.ardapektezol.com/api/v1/login" |
| 14 | } | 14 | } |
| @@ -19,7 +19,6 @@ function logout() { | |||
| 19 | fetch(`/api/v1/token`,{'method':'DELETE'}) | 19 | fetch(`/api/v1/token`,{'method':'DELETE'}) |
| 20 | .then(r=>window.location.href="/") | 20 | .then(r=>window.location.href="/") |
| 21 | } | 21 | } |
| 22 | const [token, setToken] = React.useState(null); | ||
| 23 | const [isLoggedIn, setIsLoggedIn] = React.useState(false); | 22 | const [isLoggedIn, setIsLoggedIn] = React.useState(false); |
| 24 | React.useEffect(() => { | 23 | React.useEffect(() => { |
| 25 | fetch(`/api/v1/token`) | 24 | fetch(`/api/v1/token`) |
| @@ -46,19 +45,19 @@ return ( | |||
| 46 | <> | 45 | <> |
| 47 | {isLoggedIn ? ( | 46 | {isLoggedIn ? ( |
| 48 | <Link to="/profile" tabIndex={-1} className='login'> | 47 | <Link to="/profile" tabIndex={-1} className='login'> |
| 49 | <button> | 48 | <button className='sidebar-button'> |
| 50 | <img src={profile.avatar_link} alt="" /> | 49 | <img src={profile.avatar_link} alt="" /> |
| 51 | <span>{profile.user_name}</span> | 50 | <span>{profile.user_name}</span> |
| 52 | </button> | 51 | </button> |
| 53 | <button onClick={logout}><img src={img3} alt="" /><span></span></button> | 52 | <button className='sidebar-button' onClick={logout}><img src={img3} alt="" /><span></span></button> |
| 54 | </Link> | 53 | </Link> |
| 55 | ) : ( | 54 | ) : ( |
| 56 | <Link tabIndex={-1} className='login'> | 55 | <Link tabIndex={-1} className='login' > |
| 57 | <button onClick={login}> | 56 | <button className='sidebar-button' onClick={login}> |
| 58 | <img src={img2} alt="" /> | 57 | <img src={img2} alt="" /> |
| 59 | <span><img src={img1} alt="Sign in through Steam" /></span> | 58 | <span><img src={img1} alt="Sign in through Steam" /></span> |
| 60 | </button> | 59 | </button> |
| 61 | <button disabled><span></span></button> | 60 | <button className='sidebar-button' disabled><span></span></button> |
| 62 | </Link> | 61 | </Link> |
| 63 | )} | 62 | )} |
| 64 | </> | 63 | </> |