fix: resolve ESLint parse errors, unused imports, and TS unknown type errors
- Fix catch blocks with inline comments that broke parsing - Remove unused Edit3 import from ClientReferrals - Add eslint-disable for set-state-in-effect (intentional fetch-on-mount pattern) - Fix 'e' is of type 'unknown' errors with instanceof checks
This commit is contained in:
@@ -48,10 +48,11 @@ export default function ClientDocuments({ clientId }: { clientId: string }) {
|
||||
try {
|
||||
const docs = await api.getClientDocuments(clientId, category || undefined);
|
||||
setDocuments(docs);
|
||||
} catch {}
|
||||
} catch { /* silently handled */ }
|
||||
setLoading(false);
|
||||
}, [clientId, category]);
|
||||
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect
|
||||
useEffect(() => { fetchDocs(); }, [fetchDocs]);
|
||||
|
||||
const handleUpload = async (files: FileList | File[]) => {
|
||||
@@ -61,8 +62,8 @@ export default function ClientDocuments({ clientId }: { clientId: string }) {
|
||||
await api.uploadDocument(clientId, file, { category: uploadCategory });
|
||||
}
|
||||
await fetchDocs();
|
||||
} catch (e: any) {
|
||||
alert(e.message || 'Upload failed');
|
||||
} catch (e: unknown) {
|
||||
alert(e instanceof Error ? e.message : 'Upload failed');
|
||||
}
|
||||
setUploading(false);
|
||||
};
|
||||
@@ -78,7 +79,7 @@ export default function ClientDocuments({ clientId }: { clientId: string }) {
|
||||
try {
|
||||
await api.deleteDocument(docId);
|
||||
setDocuments(prev => prev.filter(d => d.id !== docId));
|
||||
} catch {}
|
||||
} catch { /* silently handled */ }
|
||||
};
|
||||
|
||||
const handleDownload = (docId: string, name: string) => {
|
||||
|
||||
Reference in New Issue
Block a user