diff --git a/src/ChatBot.js b/src/ChatBot.js index 6a7a81c..654c31b 100644 --- a/src/ChatBot.js +++ b/src/ChatBot.js @@ -1,7 +1,7 @@ import React, { useState, useEffect } from 'react'; import styles from './ChatBot.module.css'; -const ChatBot = ({existingConversation, readOnly, hh}) => { +const ChatBot = ({ existingConversation, readOnly, hh }) => { const [messages, setMessages] = useState([ { sender: 'bot', @@ -17,12 +17,12 @@ const ChatBot = ({existingConversation, readOnly, hh}) => { const [input, setInput] = useState(''); const [isLoading, setIsLoading] = useState(false); -useEffect(()=>{ + useEffect(() => { - if (existingConversation && existingConversation.length > 0) { - setMessages(existingConversation); - } -}, [existingConversation]) + if (existingConversation && existingConversation.length > 0) { + setMessages(existingConversation); + } + }, [existingConversation]) useEffect(() => { if (!localStorage.getItem('session')) { function generateUUID() { @@ -36,7 +36,7 @@ useEffect(()=>{ const sessionId = generateUUID(); const dateNow = new Date().toISOString(); - localStorage.setItem('session', JSON.stringify({ sessionId: sessionId, lastSeen: dateNow})) + localStorage.setItem('session', JSON.stringify({ sessionId: sessionId, lastSeen: dateNow })) } }, []); @@ -92,7 +92,7 @@ useEffect(()=>{ }; return ( -