From 2fa52b90e34e9806fb179ab890c4a018d7b088a1 Mon Sep 17 00:00:00 2001 From: laxmanhalaki Date: Thu, 12 Feb 2026 20:54:03 +0530 Subject: [PATCH] code sanitized removed mail refernces and url refernces ualong with that routes are secured --- src/App.tsx | 5 +- .../CreateRequest/ApprovalWorkflowStep.tsx | 60 +- src/contexts/AuthContext.tsx | 98 +-- .../ClaimApproverSelectionStep.tsx | 2 +- .../components/request-detail/WorkflowTab.tsx | 2 +- .../modals/EmailNotificationTemplateModal.tsx | 2 +- src/hooks/useRequestDetails.ts | 152 ++-- src/services/tanflowAuth.ts | 42 +- src/utils/claimManagementDatabase.ts | 161 +--- src/utils/customRequestDatabase.ts | 715 +----------------- src/utils/dealerDatabase.ts | 188 ----- 11 files changed, 177 insertions(+), 1250 deletions(-) delete mode 100644 src/utils/dealerDatabase.ts diff --git a/src/App.tsx b/src/App.tsx index 21442ab..a8dfa86 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -27,7 +27,6 @@ import { CreateAdminRequest } from '@/pages/CreateAdminRequest/CreateAdminReques import { ApprovalActionModal } from '@/components/modals/ApprovalActionModal'; import { Toaster } from '@/components/ui/sonner'; import { toast } from 'sonner'; -import { CUSTOM_REQUEST_DATABASE } from '@/utils/customRequestDatabase'; import { AuthCallback } from '@/pages/Auth/AuthCallback'; import { createClaimRequest } from '@/services/dealerClaimApi'; import { ManagerSelectionModal } from '@/components/modals/ManagerSelectionModal'; @@ -193,7 +192,7 @@ function AppRoutes({ onLogout }: AppProps) { // Regular custom request submission (old flow without API) // Generate unique ID for the new custom request - const requestId = `RE-REQ-2024-${String(Object.keys(CUSTOM_REQUEST_DATABASE).length + dynamicRequests.length + 1).padStart(3, '0')}`; + const requestId = `RE-REQ-2024-${String(dynamicRequests.length + 1).padStart(3, '0')}`; // Create full custom request object const newCustomRequest = { @@ -217,7 +216,7 @@ function AppRoutes({ onLogout }: AppProps) { name: 'Current User', role: requestData.initiatorRole || 'Employee', department: requestData.department || 'General', - email: 'current.user@royalenfield.com', + email: 'current.user@{{API_DOMAIN}}', phone: '+91 98765 43290', avatar: 'CU' }, diff --git a/src/components/workflow/CreateRequest/ApprovalWorkflowStep.tsx b/src/components/workflow/CreateRequest/ApprovalWorkflowStep.tsx index 10a1ffd..527b27f 100644 --- a/src/components/workflow/CreateRequest/ApprovalWorkflowStep.tsx +++ b/src/components/workflow/CreateRequest/ApprovalWorkflowStep.tsx @@ -45,18 +45,18 @@ export function ApprovalWorkflowStep({ useEffect(() => { const approverCount = formData.approverCount || 1; const currentApprovers = formData.approvers || []; - + // Ensure we have the correct number of approvers if (currentApprovers.length < approverCount) { const newApprovers = [...currentApprovers]; // Fill missing approver slots for (let i = currentApprovers.length; i < approverCount; i++) { if (!newApprovers[i]) { - newApprovers[i] = { - email: '', - name: '', - level: i + 1, - tat: '' as any + newApprovers[i] = { + email: '', + name: '', + level: i + 1, + tat: '' as any }; } } @@ -71,7 +71,7 @@ export function ApprovalWorkflowStep({ const newApprovers = [...formData.approvers]; const previousEmail = newApprovers[index]?.email; const emailChanged = previousEmail !== value; - + newApprovers[index] = { ...newApprovers[index], email: value, @@ -94,8 +94,8 @@ export function ApprovalWorkflowStep({ try { // Check for duplicates in other approver slots (excluding current index) const isDuplicateApprover = formData.approvers?.some( - (approver: any, idx: number) => - idx !== index && + (approver: any, idx: number) => + idx !== index && (approver.userId === selectedUser.userId || approver.email?.toLowerCase() === selectedUser.email?.toLowerCase()) ); @@ -196,9 +196,9 @@ export function ApprovalWorkflowStep({
-