Code Cleanup

This commit is contained in:
Ashish Deo
2023-10-30 18:38:14 +05:30
parent a84dc66c27
commit aeb2ed70af
2 changed files with 7 additions and 6 deletions

View File

@@ -74,8 +74,10 @@ const FeedbackDetailItem = ({
caseId,
hideAddress,
}: IFeedbackDetailItem) => {
const caseDetails = useAppSelector((state) => state.allCases.caseDetails[caseId]);
const { agentId } = useAppSelector((state) => ({ agentId: state.user.user?.referenceId!! }));
const { agentId, caseDetails } = useAppSelector((state) => ({
agentId: state.user.user?.referenceId || null,
caseDetails: state.allCases.caseDetails?.[caseId] || null,
}));
const [isWhastappSendLoading, setIsWhatsappSendLoading] = useState(false);
const isGeolocation = feedbackItem?.source?.sourceType === VisitType.GEOLOCATION;

View File

@@ -34,12 +34,11 @@ import { shareToWhatsapp } from '../../../services/FeedbackWhatsApp';
import { IAddress } from '@types/addressGeolocation.types';
interface IFeedbackListItem {
feedbackItem: IFeedback;
feedbackItem: IFeedback | IUnSyncedFeedbackItem;
showHorizontalLine?: boolean;
loanAccountNumber: string;
caseId: string;
}
// removed (feedbackItem: IFeedback | IUnSyncedFeedbackItem;) | IUnSyncedFeedbackItem
const FeedbackListItem: React.FC<IFeedbackListItem> = ({
feedbackItem,
@@ -58,8 +57,8 @@ const FeedbackListItem: React.FC<IFeedbackListItem> = ({
};
const [isWhastappSendLoading, setIsWhatsappSendLoading] = useState(false);
const { agentId, caseDetails } = useAppSelector((state) => ({
agentId: state.user.user?.referenceId!!,
caseDetails: state.allCases.caseDetails[caseId],
agentId: state.user.user?.referenceId || null,
caseDetails: state.allCases.caseDetails?.[caseId] || null,
}));
const throttledSendToWhatsapp = React.useRef(debounce(shareToWhatsapp, 500));