68aee7cc by Jonille Arreglo

27190_loggedin

1 parent 5ae7a722
......@@ -57,7 +57,28 @@ function App() {
async function handleSubmit(e){
e.preventDefault();
let aiUser = window.btutil_getCookie('aiwp_logged_in');
if(!aiUser) {
window.location.href = process.env.REACT_APP_AUTH_FAILED_REDIRECTION_URL;
return;
} else {
let objBody = { aiwp_logged_in: aiUser };
let params = [];
params['objBody'] = objBody;
params['strUrl'] = process.env.REACT_APP_EXTERNAL_API_URL + '/e/v1/authenticate/';
window.btutil_checkAuthentication(params, function(res) {
if (!res.success) {
window.location.href = process.env.REACT_APP_AUTH_FAILED_REDIRECTION_URL;
} else {
submitPrompt();
}
}, function(res) {});
}
}
async function submitPrompt() {
const userInput = ['what', 'why', 'when', 'where' , 'which', 'did', 'do', 'how', 'can', 'are', 'who'];
const userInputRegex = new RegExp(`\\b(${userInput.join('|')})\\b`, 'gi');
const inputMatches = chatInput.match(userInputRegex);
......@@ -91,7 +112,6 @@ function App() {
messages = JSON.stringify(chatLogTurboNew);
}
let intervalId = startInterval();
try {
const response = await fetch(process.env.REACT_APP_SERVER_URL + "/api", {
method: "POST",
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!