From 2f69733e9815ab2f221bc899ff0f5bfc367ab636 Mon Sep 17 00:00:00 2001 From: yashdev9274 Date: Mon, 20 May 2024 13:22:26 +0530 Subject: [PATCH] update: orgId layout page. --- src/app/(main)/agency/[agencyId]/layout.tsx | 17 +++++++++++++++-- src/lib/queries.ts | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/app/(main)/agency/[agencyId]/layout.tsx b/src/app/(main)/agency/[agencyId]/layout.tsx index 6c5ff62..3a8eaba 100644 --- a/src/app/(main)/agency/[agencyId]/layout.tsx +++ b/src/app/(main)/agency/[agencyId]/layout.tsx @@ -1,5 +1,6 @@ +import Sidebar from '@/components/sidebar' import Unauthorized from '@/components/unauthorized' -import { verifyAndAcceptInvitation } from '@/lib/queries' +import { getNotificationAndUser, verifyAndAcceptInvitation } from '@/lib/queries' import { currentUser } from '@clerk/nextjs' import { redirect } from "next/navigation" import React from 'react' @@ -28,8 +29,20 @@ const layout = async ({ children, params }: Props) => { ) return + let allNoti: any = [] + const notifications = await getNotificationAndUser(agencyId) + if (notifications) allNoti = notifications + return ( -
layout
+
+ +
+ +
+
) } diff --git a/src/lib/queries.ts b/src/lib/queries.ts index cd0b12e..7b707a0 100644 --- a/src/lib/queries.ts +++ b/src/lib/queries.ts @@ -281,7 +281,7 @@ export const getNotificationAndUser = async (agencyId: string) => { where: { agencyId }, include: { User: true }, orderBy: { - createdAt: 'desc' + createdAt: 'desc' // ordering in descending order } }) return response