From 9cda2a687936c908951fe33578713ad972990421 Mon Sep 17 00:00:00 2001 From: LeanderMundkowsky Date: Wed, 4 Feb 2026 14:27:35 +0100 Subject: [PATCH] Fix minor Bugs, --- .idea/dataSources.xml | 6 +-- .idea/data_source_mapping.xml | 1 + src/app/(auth-required)/new/ticket/page.tsx | 6 +-- .../(auth-required)/tickets/[slug]/page.tsx | 12 +++-- src/app/(auth-required)/tickets/page.tsx | 1 - src/app/(no-auth)/layout.tsx | 44 ------------------ src/app/{(auth-required) => }/layout.tsx | 0 src/app/not-found.tsx | 12 +++++ src/components/DAL/dal.ts | 1 - src/components/TicketTable/Row.tsx | 2 +- src/components/TicketTable/TicketTable.tsx | 46 ++----------------- src/components/UserTable/UserTable.tsx | 5 +- src/components/revalidatePathClient/export.ts | 1 + .../revalidatePathClient.ts | 6 +++ src/components/svg/add.tsx | 15 ++++++ 15 files changed, 58 insertions(+), 100 deletions(-) delete mode 100644 src/app/(no-auth)/layout.tsx rename src/app/{(auth-required) => }/layout.tsx (100%) create mode 100644 src/app/not-found.tsx create mode 100644 src/components/revalidatePathClient/export.ts create mode 100644 src/components/revalidatePathClient/revalidatePathClient.ts create mode 100644 src/components/svg/add.tsx diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml index 7900cc8..3648474 100644 --- a/.idea/dataSources.xml +++ b/.idea/dataSources.xml @@ -2,10 +2,10 @@ - mysql.8 + mariadb true - com.mysql.cj.jdbc.Driver - jdbc:mysql://localhost:3306/ticket_sys + org.mariadb.jdbc.Driver + jdbc:mariadb://localhost:3306/ticket_sys $ProjectFileDir$ diff --git a/.idea/data_source_mapping.xml b/.idea/data_source_mapping.xml index d6749b4..77d3c68 100644 --- a/.idea/data_source_mapping.xml +++ b/.idea/data_source_mapping.xml @@ -2,5 +2,6 @@ + \ No newline at end of file diff --git a/src/app/(auth-required)/new/ticket/page.tsx b/src/app/(auth-required)/new/ticket/page.tsx index f7dbe9e..415c7d5 100644 --- a/src/app/(auth-required)/new/ticket/page.tsx +++ b/src/app/(auth-required)/new/ticket/page.tsx @@ -7,6 +7,7 @@ import {getCategories, Ticket} from "@/components/Tickets"; import {sendRequestwTokenClient} from "@/app/actions/auth"; import {getUser} from "@/components/getUser"; import {useRouter} from "next/navigation"; +import {revalidatePathClient} from "@/components/revalidatePathClient/revalidatePathClient"; export default function Page({ params, @@ -64,7 +65,6 @@ export default function Page({ const formAction = (e: FormData) => { - // Wenn du die Daten aus dem e: FormData Objekt ziehen willst (wie bisher): const ticket: Ticket = { status: Number(e.get("status")), priority: Number(e.get("priority")), @@ -74,7 +74,7 @@ export default function Page({ username: currentUser || "none", }; sendRequestwTokenClient(`/ticket/create`, "POST",JSON.stringify(ticket)) - router.push("/tickets") + revalidatePathClient("/tickets","page").then( async () => router.push("/tickets",)) }; if (!currentUser) { @@ -151,7 +151,7 @@ export default function Page({ onChange={handleChange} /> - + diff --git a/src/app/(auth-required)/tickets/[slug]/page.tsx b/src/app/(auth-required)/tickets/[slug]/page.tsx index b2efcf0..fb13611 100644 --- a/src/app/(auth-required)/tickets/[slug]/page.tsx +++ b/src/app/(auth-required)/tickets/[slug]/page.tsx @@ -6,6 +6,8 @@ import { Button } from "@/components/Button"; import {DetailedTicket, getCategories, Ticket} from "@/components/Tickets"; import { getTicket } from "@/components/Tickets/getTicket"; import {sendRequestwTokenClient} from "@/app/actions/auth"; +import {revalidatePathClient} from "@/components/revalidatePathClient/revalidatePathClient"; +import {router} from "next/client"; export default function Page({ params, @@ -51,10 +53,8 @@ export default function Page({ }; const formAction = (e: FormData) => { - // Hier kannst du die Daten an den Server schicken console.log("Form submitted with:", currentTicket); - // Wenn du die Daten aus dem e: FormData Objekt ziehen willst (wie bisher): const ticket: Ticket = { status: Number(e.get("status")), priority: Number(e.get("priority")), @@ -63,8 +63,12 @@ export default function Page({ description: e.get("description")?.toString() || "none", username: currentTicket?.username || "none", }; - sendRequestwTokenClient(`/ticket/update/${ticketId}`, "POST",JSON.stringify(ticket)) - alert("Gespeichert!"); + + const asyncRedirect = async () => { + await revalidatePathClient(`/tickets/${ticketId}`,"page") + await router.push("/tickets") + } + sendRequestwTokenClient(`/ticket/update/${ticketId}`, "POST",JSON.stringify(ticket)).then(asyncRedirect) }; if (!currentTicket) return
Lade Ticket...
; diff --git a/src/app/(auth-required)/tickets/page.tsx b/src/app/(auth-required)/tickets/page.tsx index 07ab414..3b26ca3 100644 --- a/src/app/(auth-required)/tickets/page.tsx +++ b/src/app/(auth-required)/tickets/page.tsx @@ -12,7 +12,6 @@ export default async function Page() { Deine Tickets - ); } \ No newline at end of file diff --git a/src/app/(no-auth)/layout.tsx b/src/app/(no-auth)/layout.tsx deleted file mode 100644 index a007abd..0000000 --- a/src/app/(no-auth)/layout.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import type {Metadata} from "next"; -import {Geist, Geist_Mono} from "next/font/google"; -import "@/app/globals.css"; -import React from "react"; -import {Header} from "@/components/Header/Header"; -import {Footer} from "@/components/Footer"; - -const geistSans = Geist({ - variable: "--font-geist-sans", - subsets: ["latin"], -}); - -const geistMono = Geist_Mono({ - variable: "--font-geist-mono", - subsets: ["latin"], -}); - -export const metadata: Metadata = { - title: "Create Next App", - description: "Generated by create next app", -}; - -export default function RootLayout({ - children, - }: Readonly<{ - children: React.ReactNode; -}>) { - - return ( - - - -
-
- {children} -
-