Spaces:
Runtime error
Runtime error
Download web_app/frontend/src/components/emailService.jsx from luminlab-adapt/web-app-temp: direct link, hf CLI and curl.
- Browser
- Download file 792 Bytes
-
https://huggingface.co/spaces/luminlab-adapt/web-app-temp/resolve/main/web_app/frontend/src/components/emailService.jsx
- Command line
-
hf download hf://spaces/luminlab-adapt/web-app-temp/web_app/frontend/src/components/emailService.jsx
-
curl -L -o emailService.jsx https://huggingface.co/spaces/luminlab-adapt/web-app-temp/resolve/main/web_app/frontend/src/components/emailService.jsx
792 Bytes
| import axios from 'axios'; | |
| const handleSendEmail = async (email) => { | |
| try { | |
| // Fetch chatHistory from localStorage | |
| const storedChatHistory = localStorage.getItem('chatHistory'); | |
| // If it doesn't exist or is empty, return | |
| if (!storedChatHistory || storedChatHistory.length === 0) { | |
| console.error("Chat history is empty."); | |
| return; | |
| } | |
| const response = await axios.post('http://localhost:5000/exportChat', { | |
| email: email, | |
| chatHistory: JSON.parse(storedChatHistory) // Convert the stringified JSON to an object | |
| }); | |
| console.log(response.data); | |
| } catch (error) { | |
| console.error("Error sending email:", error); | |
| } | |
| }; | |
| export default handleSendEmail; |