File size: 925 Bytes
58973c7 50f8987 58973c7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
import { TextField, Button, Box } from '@mui/material';
import { useState } from 'react';
function DocumentInput() {
const [url, setUrl] = useState('');
const handleSubmit = async () => {
try {
const response = await fetch('/api/crawl/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ url }),
});
if (!response.ok) throw new Error('Network response was not ok');
setUrl('');
} catch (error) {
console.error('Error:', error);
}
};
return (
<Box sx={{ mb: 4, display: 'flex', gap: 2 }}>
<TextField
fullWidth
label="Source Documentation"
value={url}
onChange={(e) => setUrl(e.target.value)}
/>
<Button variant="contained" onClick={handleSubmit}>
Pull Source Docs
</Button>
</Box>
);
}
export default DocumentInput; |