chatpage.js
1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import React from "react";
import { Typography, Icon } from 'antd';
import Chatbot from '../Chatbot/Chatbot';
import { withRouter } from "react-router-dom";
const { Title } = Typography;
let userKeyword = "";
let userName = "유저";
let autoSearch = 0;
console.log("챗페이지 밖");
function chatpage() {
console.log("챗페이지 안")
if(sessionStorage.length === 2){
console.log("세션스토리지 안")
userKeyword = sessionStorage.getItem("Now_userKeyword");
userName = sessionStorage.getItem("Now_userName");
sessionStorage.clear();
autoSearch = 1;
}
window.history.pushState(null, null, "/chat");
window.onpopstate = function(event){
window.history.go(1)
};
return (
<div>
<div style={{ display: 'flex', justifyContent: 'center', marginTop: '1rem' }}>
<Title level={2} >CHATBOT <Icon type="robot" /></Title>
</div>
<div style={{ display: 'flex', justifyContent: 'center' }}>
<Chatbot userName = {userName} userKeyword = {userKeyword} autoSearch = {autoSearch}/>
</div>
</div>
)
}
export default withRouter(chatpage);