diff --git a/src/Dashbord/live-chat/LiveChat.jsx b/src/Dashbord/live-chat/LiveChat.jsx index 6787d7a..4018a1e 100644 --- a/src/Dashbord/live-chat/LiveChat.jsx +++ b/src/Dashbord/live-chat/LiveChat.jsx @@ -1,9 +1,44 @@ -import React, { useContext } from 'react'; +import React, { useContext, useState } from 'react'; import { AuthContex } from '../../Providers/AuthProvider'; - +import Swal from 'sweetalert2'; const LiveChat = () => { // received user from AuthContex - const {user} = useContext(AuthContex) + const {user} = useContext(AuthContex); + const [query, setQuery] = useState(''); + const handleQueryChange = (e) => { + setQuery(e.target.value); + }; + + const userQuery = () => { + + // i comment out Full Code For Key Issues + fetch('http://localhost:5000/chat', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', }, + body: JSON.stringify({query}), + }) + .then((response) => response.json()) + .then((data) => { + console.log(data); + }) + .catch((error) => { + // Handle error + console.error('Error sending query:', error); + }); + }; + const handleSubmit = (e) => { + e.preventDefault(); + Swal.fire({ + icon: "error", + title: "Oops...", + text: "OpenAi Key Is Expire.", + footer: '
This issue from Developer Site. Please contact with me
' + }); + + // userQuery(); //function for send data + }; + return (Lorem ipsum, dolor sit amet consectetur adipisicing elit. Nostrum perferendis eveniet recusandae.
Ask Me
*/} - - -