feat: implement audit session module with centralized API service and axios interceptors
This commit is contained in:
@@ -67,7 +67,6 @@ export const AuditSession: React.FC = () => {
|
||||
const [reportSending, setReportSending] = useState(false);
|
||||
|
||||
const DEVS = ['aromal', 'divya', 'Poonam', 'ravi', 'Kaushik', 'Saleth', 'Jagan', 'Yash', 'faraz_siddiqui', 'brinda.n', 'SasiVardhan', 'Shubham'];
|
||||
const ROCKETCHAT_WEBHOOK_PATH = '/api/rocketchat/hooks/6a22ad73a88367bc6e1095a2/xcHkbDSce5rCwofdBZF3ri2rb6ntxT2mahqT6Gg7iKdectYk';
|
||||
|
||||
const handleSendReport = async () => {
|
||||
if (!reportDev || !reportMessage.trim()) return;
|
||||
@@ -111,7 +110,7 @@ export const AuditSession: React.FC = () => {
|
||||
reportMessage.trim(),
|
||||
].join('\n');
|
||||
|
||||
await axiosClient.post(ROCKETCHAT_WEBHOOK_PATH, { channel: `@${reportDev}`, text: context });
|
||||
await axiosClient.post('/api/audit/report', { channel: `@${reportDev}`, text: context });
|
||||
setIsReportDialogOpen(false);
|
||||
setReportDev('');
|
||||
setReportMessage('');
|
||||
@@ -446,13 +445,13 @@ export const AuditSession: React.FC = () => {
|
||||
// Call API 2: Notify dashboard — only for true anomaly, endpoint differs by mode
|
||||
if (isAnomalyBool) {
|
||||
if (isRectActive) {
|
||||
// Rectification mode: /auditor/anomaly/completed, site_id as number
|
||||
// Rectification mode: /auditor/anomaly/close, site_id as number
|
||||
await activityFeedsService.markAnomalyCompleted({
|
||||
anomaly_id: [currentAnomaly.id],
|
||||
site_id: currentAnomaly.site_id
|
||||
});
|
||||
} else {
|
||||
// Normal audit mode: /auditor/anomaly/update, site_id as string
|
||||
// Normal audit mode: /auditor/anomaly/submit, site_id as string
|
||||
await activityFeedsService.updateAnomalyInDashboard({
|
||||
site_id: String(currentAnomaly.site_id),
|
||||
anomaly_id: [currentAnomaly.id]
|
||||
|
||||
Reference in New Issue
Block a user