Skip to content

Commit

Permalink
Refactor Layout Provider component
Browse files Browse the repository at this point in the history
  • Loading branch information
Vyshnav001 committed Sep 29, 2024
1 parent 705be20 commit 3f621bc
Showing 1 changed file with 24 additions and 23 deletions.
47 changes: 24 additions & 23 deletions src/components/Layout/Provider.tsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
"use client";;
"use client";
import { ourFileRouter } from "@/app/api/uploadthing/core";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { NextSSRPlugin } from "@uploadthing/react/next-ssr-plugin";
import { SessionProvider } from "next-auth/react";
import { ReactNode } from "react";
import { Toaster } from "sonner";
import { extractRouterConfig } from "uploadthing/server";
import React from "react";

export default function Providers({ children }: { children: ReactNode }) {
const queryClient = new QueryClient();
return (
<>
<SessionProvider>
<QueryClientProvider client={queryClient}>
<NextSSRPlugin routerConfig={extractRouterConfig(ourFileRouter)} />
{children}
<Toaster
position="top-center"
toastOptions={{
classNames: {
error: "text-red-400 border-red-400",
success: "text-green-400 border-green-400",
warning: "text-yellow-400 border-yellow-400",
info: "text-blue-400 border-blue-400",
},
}}
/>
</QueryClientProvider>
</SessionProvider>
</>
);
const queryClient = new QueryClient();
return (
<>
<SessionProvider>
<QueryClientProvider client={queryClient}>
<NextSSRPlugin routerConfig={extractRouterConfig(ourFileRouter)} />
{children}
<Toaster
position="top-center"
toastOptions={{
classNames: {
error: "text-red-400 border-red-400",
success: "text-green-400 border-green-400",
warning: "text-yellow-400 border-yellow-400",
info: "text-blue-400 border-blue-400",
},
}}
/>
</QueryClientProvider>
</SessionProvider>
</>
);
}

0 comments on commit 3f621bc

Please sign in to comment.