Chat.js - quentinblampey/facteur-de-reussite GitHub Wiki
Chat.js : This page is the page on which the user can chat with the chatbot.
componentDidMount:
Initialization method that is supposed initialize the chat by getting the first question.
onChange :
Method that refresh content when the user types a message
onSubmitButton :
used when the user answers a multiple choices question by clicking a button :
- sends the selected answer to the back, gets the update user, and update the chat (request put to /api/users/idQ)
- asks for the next question to the front and update the chat (request post to /api/questions)
onSubmit :
Used when the user answers a free answer question by typing a message :
- sends the selected answer to the back, gets the update user, and update the chat (request put to /api/users/idQ)
- asks for the next question to the front and update the chat (request post to /api/questions)
render :
- displays the previous messages
- displays the buttons to answer if the question suggests answers
- displays the chat bar to type messages