Seperated feedback flow for Inhouse and External agents

This commit is contained in:
Ashish Deo
2023-10-30 15:01:21 +05:30
parent 34549f7e90
commit 5dfe949e12

View File

@@ -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<ILockData | null>(null);
const isExternalAgentRef = useRef<boolean>(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);
};