MCPcopy Create free account
hub / github.com/ScrapeGraphAI/scrapecraft / handleAddUrl

Function handleAddUrl

frontend/src/components/Pipeline/URLManager.tsx:12–32  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10 const { currentPipeline, updatePipeline } = usePipelineStore();
11
12 const handleAddUrl = async () => {
13 if (!newUrl.trim() || !currentPipeline) return;
14
15 // Validate URL
16 setIsValidating(true);
17 try {
18 const response = await api.post('/scraping/validate-url', { url: newUrl });
19
20 if (response.data.valid) {
21 const updatedUrls = [...currentPipeline.urls, newUrl];
22 updatePipeline(currentPipeline.id, { urls: updatedUrls });
23 setNewUrl('');
24 } else {
25 alert(`Invalid URL: ${response.data.error || 'URL is not accessible'}`);
26 }
27 } catch (error) {
28 alert('Failed to validate URL');
29 } finally {
30 setIsValidating(false);
31 }
32 };
33
34 const handleRemoveUrl = (urlToRemove: string) => {
35 if (!currentPipeline) return;

Callers 1

handleKeyPressFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected