diff --git a/src/app/(main)/agency/[agencyId]/layout.tsx b/src/app/(main)/agency/[agencyId]/layout.tsx index 2cbdab1..6c5ff62 100644 --- a/src/app/(main)/agency/[agencyId]/layout.tsx +++ b/src/app/(main)/agency/[agencyId]/layout.tsx @@ -1,3 +1,4 @@ +import Unauthorized from '@/components/unauthorized' import { verifyAndAcceptInvitation } from '@/lib/queries' import { currentUser } from '@clerk/nextjs' import { redirect } from "next/navigation" @@ -25,11 +26,11 @@ const layout = async ({ children, params }: Props) => { user.privateMetadata.role !== 'AGENCY_OWNER' && user.privateMetadata.role !== 'AGENCY_ADMIN' ) - // return + return - return ( -
layout
- ) + return ( +
layout
+ ) } export default layout; \ No newline at end of file diff --git a/src/components/sidebar/menu-options.tsx b/src/components/sidebar/menu-options.tsx index 52e8105..9ea4d70 100644 --- a/src/components/sidebar/menu-options.tsx +++ b/src/components/sidebar/menu-options.tsx @@ -1,3 +1,5 @@ +"use client" + import React from 'react' import { Agency, diff --git a/src/lib/queries.ts b/src/lib/queries.ts index ace7ccd..cd0b12e 100644 --- a/src/lib/queries.ts +++ b/src/lib/queries.ts @@ -273,4 +273,19 @@ export const upsertAgency = async (agency: Agency, price?: Plan) => { } catch (error) { console.log(error) } +} + +export const getNotificationAndUser = async (agencyId: string) => { + try { + const response = await db.notification.findMany({ + where: { agencyId }, + include: { User: true }, + orderBy: { + createdAt: 'desc' + } + }) + return response + } catch (error) { + console.log(error) + } } \ No newline at end of file