You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running it on the browser and triggering the onPrechatSubmit and onChatStarted, this is the order on the browser's console:
null --> console.log(name);
pre-chat submitted! --> console.log('pre submit submitted!');
started --> console.log('started');
The text was updated successfully, but these errors were encountered:
`import axios from 'axios';
import { useEffect, useRef } from 'react';
const TawkMessengerReact = require('@tawk.to/tawk-messenger-react');
const ChatSupport = () => {
const onPrechatSubmit = async (data: IPreChatDetails[]) => {
try {
const response = await axios.post('/api/sample', data);
const name = response.data.user[0].answer;
const email = response.data.user[1].answer;
localStorage.removeItem('name');
localStorage.removeItem('email');
localStorage.setItem('name', name);
localStorage.setItem('email', email);
console.log('pre submit submitted!');
} catch (err) {
console.error(err);
}
};
const onChatStarted = async () => {
try {
const name = localStorage.getItem('name');
const email = localStorage.getItem('email');
console.log(name);
const response = await axios.post('/api/sample', {
name,
email,
});
console.log('started');
} catch (err) {
console.log(err);
}
};
return (
);
};
export default ChatSupport;
`
When running it on the browser and triggering the onPrechatSubmit and onChatStarted, this is the order on the browser's console:
null --> console.log(name);
pre-chat submitted! --> console.log('pre submit submitted!');
started --> console.log('started');
The text was updated successfully, but these errors were encountered: