This commit is contained in:
ahmed531998 2023-08-03 11:18:06 +02:00
parent b515a4ab36
commit 1abccba69d
2 changed files with 8 additions and 4 deletions

1
.dockerignore Normal file
View File

@ -0,0 +1 @@
.git

View File

@ -15,6 +15,7 @@ const ChatPage = () => {
const tick = useRef() const tick = useRef()
const [timer, setTimer] = useState(0); const [timer, setTimer] = useState(0);
const [stat, setStat] = useState("start"); const [stat, setStat] = useState("start");
const [err, setErr] = useState("");
useEffect(() => { useEffect(() => {
@ -29,6 +30,7 @@ const ChatPage = () => {
}, },
}).then(r => r.json()).then(r => { }).then(r => r.json()).then(r => {
setStat(r.stat); setStat(r.stat);
setErr(r.err);
}).catch((error) => { }).catch((error) => {
console.error('Error:', error); console.error('Error:', error);
}); });
@ -48,6 +50,7 @@ const ChatPage = () => {
}, },
}).then(r => r.json()).then(r => { }).then(r => r.json()).then(r => {
setStat(r.stat); setStat(r.stat);
setErr(r.err);
}).catch((error) => { }).catch((error) => {
console.error('Error:', error); console.error('Error:', error);
}); });
@ -69,10 +72,10 @@ const ChatPage = () => {
} }
return ( return (
<div> <div>
{stat==="waiting" && <p>Loading resources...</p>} {stat==="waiting" && <p>Loading resources + {token} ...</p>}
{stat==="start" && <p>Connecting to Server...</p>} {stat==="start" && <p>Connecting to Server + {token} ...</p>}
{stat==="rejected" && <p>Unauthorized Use...</p>} {stat==="rejected" && <p>Unauthorized Use + {token} ...</p>}
{stat==="init_dm_error" && <p>DM Init Err...</p>} {stat==="init_dm_error" && <p> {err} + {token} </p>}
{stat==="done" && <ChatBox props={{ updateNeedForm, messages, updateMessages, token}} /> } {stat==="done" && <ChatBox props={{ updateNeedForm, messages, updateMessages, token}} /> }
{stat==="done" && needForm && <FeedbackForm props={{ updateNeedForm, messages }} /> } {stat==="done" && needForm && <FeedbackForm props={{ updateNeedForm, messages }} /> }