+
{children}
diff --git a/src/app/layout.tsx b/src/app/layout.tsx
index 38fe4626a..94cfbdaa2 100644
--- a/src/app/layout.tsx
+++ b/src/app/layout.tsx
@@ -5,6 +5,7 @@ import "./globals.css";
import Providers from "~/components/providers";
import { Toaster } from "~/components/ui/toaster";
+import AuthProvider from "~/contexts/authContext";
const inter = Inter({ subsets: ["latin"] });
export const metadata: Metadata = {
@@ -20,9 +21,9 @@ export default function RootLayout({
return (
-
+
- {children}
+
{children}
diff --git a/src/components/adminDashboard/CardComponent.tsx b/src/components/adminDashboard/CardComponent.tsx
deleted file mode 100644
index df4594d85..000000000
--- a/src/components/adminDashboard/CardComponent.tsx
+++ /dev/null
@@ -1,47 +0,0 @@
-import Image from "next/image";
-import { FC } from "react";
-
-interface CardProperties {
- title: string;
- value: string | number;
- description: string;
- icon: string;
-}
-
-const CardComponent: FC
= ({
- title,
- value,
- description,
- icon,
-}) => {
- return (
- <>
-
-
-
- {title}
-
-
-
-
-
-
-
- {value}
-
-
- {description}
-
-
-
- >
- );
-};
-
-export default CardComponent;
diff --git a/src/components/adminDashboard/TopProductsComponent.tsx b/src/components/adminDashboard/TopProductsComponent.tsx
index c2444f180..418e533d0 100644
--- a/src/components/adminDashboard/TopProductsComponent.tsx
+++ b/src/components/adminDashboard/TopProductsComponent.tsx
@@ -1,5 +1,5 @@
-import Image from "next/image";
-import React from "react";
+import { ArrowUpRightIcon } from "lucide-react";
+import { FC } from "react";
import { Card } from "../ui/card";
@@ -13,21 +13,7 @@ type TopProductsProperties = {
gradients: string[];
};
-const ExternalLinkIcon = () => {
- return (
- <>
-
- >
- );
-};
-
-const TopProductsComponent: React.FC = ({
+const TopProductsComponent: FC = ({
data,
gradients,
}) => {
@@ -45,7 +31,7 @@ const TopProductsComponent: React.FC = ({
+
);
}
diff --git a/src/config/auth.config.ts b/src/config/auth.config.ts
index 5121d4088..3153a0851 100644
--- a/src/config/auth.config.ts
+++ b/src/config/auth.config.ts
@@ -56,23 +56,29 @@ export default {
if (account && account.provider === "google" && profile?.email) {
return profile.email.endsWith("@gmail.com");
}
+
return false;
},
async jwt({ token, user, account }) {
if (account && account.provider !== "google") {
- return { ...token, ...user };
+ return { token, user };
}
const response: ApiResponse = (await googleAuth(
account as Profile,
)) as ApiResponse;
- return { ...token, ...response };
+ user = response?.data?.user;
+
+ return { ...token };
+ },
+ async session({ session }) {
+ return session;
},
async redirect({ url, baseUrl }) {
if (url === "/login") {
return baseUrl;
}
- return "/register/organisation";
+ return "/dashboard/admin";
},
},
pages: {
diff --git a/src/contexts/authContext.tsx b/src/contexts/authContext.tsx
new file mode 100644
index 000000000..743bc444f
--- /dev/null
+++ b/src/contexts/authContext.tsx
@@ -0,0 +1,12 @@
+"use client";
+
+import { SessionProvider } from "next-auth/react";
+import { ReactNode } from "react";
+
+interface AuthProviderProperties {
+ children: ReactNode;
+}
+
+export default function AuthProvider({ children }: AuthProviderProperties) {
+ return
{children};
+}
diff --git a/src/utils/googleAuth.ts b/src/utils/googleAuth.ts
index 2b0cd0817..835e676bd 100644
--- a/src/utils/googleAuth.ts
+++ b/src/utils/googleAuth.ts
@@ -22,9 +22,7 @@ const googleAuth = async (profile: Profile) => {
id_token: profile.id_token,
});
- return {
- response,
- };
+ return response.data;
} catch (error) {
return error;
}