- Introduce `AuthWrapper` component for streamlined session-based layouts and authentication handling. - Add new utilities (`tokenUtils.ts`) for JWT decoding, token expiration checks, and refresh operations via Keycloak. - Refactor `serverCall` and `authOptions` to use centralized token refresh logic, removing redundant implementations. - Implement `ClientSessionProvider` for consistent session management across the client application. - Simplify `RootLayout` by delegating authentication enforcement to `AuthWrapper`.
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import type {Metadata} from "next";
|
|
import "./globals.css";
|
|
import {ThemeProvider} from "@/components/theme-provider";
|
|
import React from "react";
|
|
import {ErrorBoundary} from "@/components/error-boundary";
|
|
import {Toaster} from "sonner";
|
|
import {AuthWrapper} from "@/components/auth-wrapper";
|
|
import {ClientSessionProvider} from "@/components/ClientSessionProvider";
|
|
|
|
export const metadata: Metadata = {
|
|
title: "Internal | Rhein Software",
|
|
description: "Internal Tools for Rhein Software Development",
|
|
};
|
|
|
|
export default function RootLayout({
|
|
children,
|
|
}: Readonly<{
|
|
children: React.ReactNode;
|
|
}>) {
|
|
return (
|
|
<html lang="de" suppressHydrationWarning>
|
|
<body>
|
|
<ErrorBoundary>
|
|
<ClientSessionProvider>
|
|
<ThemeProvider
|
|
attribute="class"
|
|
defaultTheme="system"
|
|
enableSystem
|
|
disableTransitionOnChange
|
|
>
|
|
<AuthWrapper>{children}</AuthWrapper>
|
|
<Toaster/>
|
|
</ThemeProvider>
|
|
</ClientSessionProvider>
|
|
</ErrorBoundary>
|
|
</body>
|
|
</html>
|
|
);
|
|
} |