Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Commit

Permalink
start login
Browse files Browse the repository at this point in the history
  • Loading branch information
cstefc committed Mar 10, 2024
1 parent c74fa7e commit 3adab61
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion frontend/src/hooks/Token.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const useToken = () => {
});
}
}, [setToken, setCookies, ticket]);
return [token]
return [token];
}

export default useToken
1 change: 1 addition & 0 deletions frontend/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import HomeStudent from "./pages/student/HomeStudent.tsx";
import HomeTeacher from "./pages/teacher/HomeTeacher.tsx";
import 'bulma/css/bulma.min.css';
import './assets/styles/mainpage.css'
import LogoutScreen from "./pages/login/LogoutScreen.tsx";

const router = createBrowserRouter([
{
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/pages/login/LoginScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ function LoginScreen(): JSX.Element {

// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const [token] = useToken()
console.log(token)
if (token !== undefined){
return (<Navigate to={"/"}/>)
return (<Navigate to={"/student"}/>)
}
return (
<div>
<p> Please log in!</p>
<a href="https://login.ugent.be/login?service=https://localhost:8080/login">Log in</a>
{token && <Navigate to={"/"}/>}
</div>
);
}
Expand Down

0 comments on commit 3adab61

Please sign in to comment.