From 5dfe949e12b43ab40c49196155ed82406985da71 Mon Sep 17 00:00:00 2001 From: Ashish Deo Date: Mon, 30 Oct 2023 15:01:21 +0530 Subject: [PATCH] Seperated feedback flow for Inhouse and External agents --- src/hooks/useFirestoreUpdates.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/hooks/useFirestoreUpdates.ts b/src/hooks/useFirestoreUpdates.ts index 49417af4..1d1d09cd 100644 --- a/src/hooks/useFirestoreUpdates.ts +++ b/src/hooks/useFirestoreUpdates.ts @@ -34,7 +34,14 @@ const isUserSignedIn = () => { const useFirestoreUpdates = () => { const { - user: { user, isLoggedIn, sessionDetails, lock, selectedAgent = MY_CASE_ITEM }, + user: { + user, + isLoggedIn, + sessionDetails, + lock, + selectedAgent = MY_CASE_ITEM, + isExternalAgent = false, + }, allCases: { caseDetails, casesList }, } = useAppSelector((state: RootState) => ({ user: state.user || {}, @@ -42,6 +49,7 @@ const useFirestoreUpdates = () => { })); const isTeamLead = useAppSelector((state) => state.user.isTeamLead); const lockRef = useRef(null); + const isExternalAgentRef = useRef(isExternalAgent); useEffect(() => { lockRef.current = lock; @@ -211,7 +219,9 @@ const useFirestoreUpdates = () => { }; const subscribeToCollectionTemplate = () => { - const collectionPath = 'template/external_template'; + const collectionPath = isExternalAgent + ? 'template/inhouse_template' + : 'template/inhouse_template'; return subscribeToDoc(handleCollectionTemplateUpdate, collectionPath); };