diff --git a/admin/src/App.tsx b/admin/src/App.tsx
index 2269c2e..f0933ae 100644
--- a/admin/src/App.tsx
+++ b/admin/src/App.tsx
@@ -4,9 +4,7 @@ import Layout from "./Layout/Layout";
function App() {
return (
<>
-
-
-
+
>
);
}
diff --git a/admin/src/Layout/Layout.tsx b/admin/src/Layout/Layout.tsx
index b7df89a..f5d3f74 100644
--- a/admin/src/Layout/Layout.tsx
+++ b/admin/src/Layout/Layout.tsx
@@ -3,15 +3,20 @@ import { useEffect } from "react";
import Dashboard from "./Dashboard";
import Login from "./Login";
import Cookies from "js-cookie";
+import Landingpage from "@/components/API/Landingpage";
-type LayoutProps = {
- children: React.ReactNode;
-};
-
-const Layout: React.FC = ({ children }) => {
+const Layout: React.FC = () => {
const [isLoggedIn, setIsLoggedIn] = useState(false);
+ const [showAPI, setShowAPI] = useState(false);
useEffect(() => {
+ const path = window.location.pathname.replace(/\/+$/, ""); // remove trailing slash
+ if (path === "/api") {
+ setShowAPI(true);
+ console.log("signal");
+ return;
+ }
+
if (Cookies.get("token")) {
const verifyToken = async () => {
const response = await fetch("http://localhost:8002/api/verifyToken", {
@@ -37,17 +42,22 @@ const Layout: React.FC = ({ children }) => {
setIsLoggedIn(false);
};
- return (
- <>
+ if (showAPI) {
+ return (
- {isLoggedIn ? (
- handleLogout()} />
- ) : (
- setIsLoggedIn(true)} />
- )}
+
- {children}
- >
+ );
+ }
+
+ return (
+
+ {isLoggedIn ? (
+ handleLogout()} />
+ ) : (
+ setIsLoggedIn(true)} />
+ )}
+
);
};
diff --git a/admin/src/components/API/Landingpage.tsx b/admin/src/components/API/Landingpage.tsx
new file mode 100644
index 0000000..c0eef14
--- /dev/null
+++ b/admin/src/components/API/Landingpage.tsx
@@ -0,0 +1,11 @@
+import React from "react";
+
+const Landingpage: React.FC = () => {
+ return (
+ <>
+ Übersicht über alle Gegenstände und Ausleihen
+ >
+ );
+};
+
+export default Landingpage;