diff --git a/backend/src/main/java/com/example/backend/config/SecurityConfig.java b/backend/src/main/java/com/example/backend/config/SecurityConfig.java
index ea4c93f..6bfe020 100644
--- a/backend/src/main/java/com/example/backend/config/SecurityConfig.java
+++ b/backend/src/main/java/com/example/backend/config/SecurityConfig.java
@@ -30,7 +30,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
.exceptionHandling(e -> e
.authenticationEntryPoint(new HttpStatusEntryPoint(HttpStatus.UNAUTHORIZED)))
.oauth2Login(o -> o.defaultSuccessUrl(appUrl))
- .logout(l -> l.logoutUrl("/api/auth/logout"));
+ .logout(l -> l.logoutUrl("/api/auth/logout").logoutSuccessUrl(appUrl));
return http.build();
}
}
diff --git a/frontend/src/Component/App.tsx b/frontend/src/Component/App.tsx
index a9318ae..95c8705 100644
--- a/frontend/src/Component/App.tsx
+++ b/frontend/src/Component/App.tsx
@@ -4,17 +4,15 @@ import Details from "./App/Details.tsx";
import Header from "./App/Header.tsx";
import Footer from "./App/Footer.tsx";
-
function App() {
-
return (
<>
-
+
- }/>
- }/>
+ }/>
+ }/>
-
+
>
)
}
diff --git a/frontend/src/Component/App/Details/MovieDetails.tsx b/frontend/src/Component/App/Details/MovieDetails.tsx
index 573cb73..71a3d6b 100644
--- a/frontend/src/Component/App/Details/MovieDetails.tsx
+++ b/frontend/src/Component/App/Details/MovieDetails.tsx
@@ -49,7 +49,7 @@ export default function MovieDetails() {
- {directorsData && }
+ {directorsData && }
{actorsData && }
diff --git a/frontend/src/Component/App/Details/MovieDetails/PersonList.tsx b/frontend/src/Component/App/Details/MovieDetails/PersonList.tsx
index 09b7516..33308d7 100644
--- a/frontend/src/Component/App/Details/MovieDetails/PersonList.tsx
+++ b/frontend/src/Component/App/Details/MovieDetails/PersonList.tsx
@@ -1,11 +1,15 @@
import PersonType from "../../../../Type/PersonType.tsx";
import Person from "./PersonList/Person.tsx";
-export default function PersonList({legend, people}: { legend: string, people: PersonType[] }) {
- return
-}
\ No newline at end of file
+export default function PersonList({ legend, people }: { legend: string, people: PersonType[] }) {
+ return (
+
+ );
+}
diff --git a/frontend/src/Component/App/Header.tsx b/frontend/src/Component/App/Header.tsx
index 26a1409..07acaa8 100644
--- a/frontend/src/Component/App/Header.tsx
+++ b/frontend/src/Component/App/Header.tsx
@@ -2,32 +2,48 @@ import axios from "axios";
import {useEffect, useState} from "react";
export default function Header() {
- function login() {
+ const [isLoggedIn, setIsLoggedIn] = useState(false);
+ const [userName, setUserName] = useState('');
+ function login() {
const host = window.location.host === 'localhost:5173' ? 'http://localhost:8080' : window.location.origin
-
window.open(host + '/oauth2/authorization/github', '_self')
}
+
const loadUser = () => {
axios.get('/api/auth/me')
.then(response => {
- console.log(response.data)
- setUserName(response.data)
+ setUserName(response.data);
+ setIsLoggedIn(true);
+ })
+ .catch(() => {
+ setUserName("");
+ setIsLoggedIn(false);
})
}
+ const logout = () => {
+ const host = window.location.host === 'localhost:5173' ? 'http://localhost:8080' : window.location.origin
+ window.open(host + "/api/auth/logout", '_self');
+ };
+ const handleButtonClick = () => {
+ if (isLoggedIn) {
+ logout();
+ } else {
+ login();
+ }
+ };
useEffect(() => {
loadUser()
}, []);
- const [userName, setUserName] = useState('')
return (
);
diff --git a/frontend/src/Component/App/Main.tsx b/frontend/src/Component/App/Main.tsx
index f7cd56b..d302be4 100644
--- a/frontend/src/Component/App/Main.tsx
+++ b/frontend/src/Component/App/Main.tsx
@@ -5,8 +5,8 @@ export default function Main() {
return (
Main
-
-
+
+
);
}
\ No newline at end of file
diff --git a/frontend/src/Component/ProtectedRoutes.tsx b/frontend/src/Component/ProtectedRoutes.tsx
new file mode 100644
index 0000000..7b2d174
--- /dev/null
+++ b/frontend/src/Component/ProtectedRoutes.tsx
@@ -0,0 +1,5 @@
+
+export default function ProtectedRoutes() {
+//Protected Routes logic
+return <>>
+}
diff --git a/frontend/src/Style/Details.css b/frontend/src/Style/Details.css
index e822ef5..3c926f6 100644
--- a/frontend/src/Style/Details.css
+++ b/frontend/src/Style/Details.css
@@ -27,7 +27,15 @@ fieldset.person-list {
border: 1px solid #ccc;
border-radius: 4px;
}
-
+nav {
+ display: flex;
+ flex-direction: row;
+ justify-content: space-between;
+ align-items: center;
+ width: 100%;
+ margin-bottom: 30px;
+ padding: 10px;
+}
legend {
font-weight: bold;
margin-bottom: 0.5rem;
@@ -39,3 +47,8 @@ input[disabled] {
border: none;
padding: 0.5rem;
}
+#root {
+ width: 100%;
+ height: 100%;
+ padding: 0;
+}
diff --git a/frontend/src/index.css b/frontend/src/index.css
index 6119ad9..0a84a20 100644
--- a/frontend/src/index.css
+++ b/frontend/src/index.css
@@ -24,8 +24,6 @@ a:hover {
body {
margin: 0;
- display: flex;
- place-items: center;
min-width: 320px;
min-height: 100vh;
}