Move mantine provider to inside dashboard/ path

This commit is contained in:
sianida26 2024-02-23 20:36:03 +07:00
parent 16953fb53c
commit b881b1383f
2 changed files with 9 additions and 7 deletions

View File

@ -1,4 +1,4 @@
import { AppShell, AppShellHeader, Burger } from "@mantine/core";
import { AppShell, AppShellHeader, Burger, MantineProvider } from "@mantine/core";
import { useDisclosure } from "@mantine/hooks";
import Image from "next/image";
import React from "react";
@ -6,6 +6,7 @@ import logo from "@/assets/logos/logo.png";
import DashboardLayout from "@/modules/dashboard/components/DashboardLayout";
import getUser from "@/modules/auth/actions/getUser";
import { redirect } from "next/navigation";
import { Notifications } from "@mantine/notifications";
interface Props {
children: React.ReactNode;
@ -18,5 +19,10 @@ export default async function Layout(props: Props) {
redirect("/login");
}
return <DashboardLayout>{props.children}</DashboardLayout>;
return (
<MantineProvider>
<Notifications />
<DashboardLayout>{props.children}</DashboardLayout>
</MantineProvider>
);
}

View File

@ -5,8 +5,7 @@ import "./globals.css";
import "@mantine/core/styles.css";
import '@mantine/notifications/styles.css';
import { ColorSchemeScript, MantineProvider } from "@mantine/core";
import { Notifications } from "@mantine/notifications";
import { ColorSchemeScript } from "@mantine/core";
import { AuthContextProvider } from "@/modules/auth/contexts/AuthContext";
const inter = Inter({ subsets: ["latin"] });
@ -27,10 +26,7 @@ export default function RootLayout({
<ColorSchemeScript />
</head>
<body className={inter.className}>
<MantineProvider>
<Notifications />
<AuthContextProvider>{children}</AuthContextProvider>
</MantineProvider>
</body>
</html>
);