Program Commit
This commit is contained in:
26
frontend/src/components/Login.js
Normal file
26
frontend/src/components/Login.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import React, { useEffect } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
const Login = () => {
|
||||
const navigate = useNavigate();
|
||||
|
||||
useEffect(() => {
|
||||
const storedUser = localStorage.getItem('user');
|
||||
if (storedUser) {
|
||||
navigate('/dashboard');
|
||||
}
|
||||
}, [navigate]);
|
||||
|
||||
const handleLogin = () => {
|
||||
window.location.href = 'http://localhost:3002/auth/discord';
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h2>Login</h2>
|
||||
<button onClick={handleLogin}>Login with Discord</button>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Login;
|
||||
Reference in New Issue
Block a user