added session store and restoring data after reload page

This commit is contained in:
Wenszel
2021-03-17 19:27:57 +01:00
parent 526a97268e
commit 5e6a4cc32e
5 changed files with 278 additions and 17 deletions
+4 -4
View File
@@ -5,8 +5,8 @@ import NameInput from './components/NameInput';
function App() {
useEffect(()=>{
axios.post('http://localhost:3000', {
credentials: 'include',
axios.get('http://localhost:3000', {
withCredentials:true,
mode: 'cors'
})
.then((response)=> response.id!=null ? setRedirect(true): null);
@@ -16,8 +16,8 @@ function App() {
const idCallback = (id)=>{
setId(id);
axios.post('http://localhost:3000', {
credentials: 'include',
axios.get('http://localhost:3000', {
withCredentials:true,
mode: 'cors',
headers: { "Content-Type": "application/json" },
})
+1
View File
@@ -11,6 +11,7 @@ const NameInput = ({ idCallback }) => {
axios.post('http://localhost:3000/room/add',{
name: inputValue
},{
withCredentials:true,
"Content-Type": "application/json"
})
.then(response => {