diff --git a/src/components/Dashboard/Dashboard.js b/src/components/Dashboard/Dashboard.js index 2223ab8..bf0f32d 100644 --- a/src/components/Dashboard/Dashboard.js +++ b/src/components/Dashboard/Dashboard.js @@ -37,6 +37,7 @@ function Dashboard() { const handleClose = () => { setSignup(false); }; + let [logoutUser, setLogout] = useState(false); @@ -46,7 +47,15 @@ function Dashboard() { let [major, setMajor] = useState(""); - + console.log(user) + useEffect(() => { + console.log(logoutUser) + if (user == null && logoutUser) { + navigate("/"); + setLogout(false); + } + + }, [user]); // const items2 = [ @@ -98,7 +107,9 @@ function Dashboard() { let [nodes, setNodes] = useState({}); let [edges, setEdges] = useState({}); let [tab, setTab] = useState(0); - let [signup, setSignup] = useState(true); + + let [signup, setSignup] = useState(false); + let [colorSchema, setColorSchema] = useState("tot"); @@ -365,13 +376,15 @@ function Dashboard() { try { RequestUtils.get('/retrieve?id=' + user.uid).then((response) => response.json()) .then((data) => { - console.log(data) + console.log(data.status) if (data.status == 200) { setFirst(data.data.name); setLast(data.data.last); setYear(data.data.year); setMajor(data.data.major); - } else { + } + if(data.status == 404) { + console.log(data.status) setSignup(true); } }); @@ -466,7 +479,9 @@ function Dashboard() { label: "Logout", onClick: () => { logout(); - navigate("/"); + setLogout(true); + + } } diff --git a/src/components/Table/Table.jsx b/src/components/Table/Table.jsx index 26c3ae9..39d8451 100644 --- a/src/components/Table/Table.jsx +++ b/src/components/Table/Table.jsx @@ -77,30 +77,26 @@ const EditableCell = ({ } return {childNode}; }; - -const initialData = [ - { - key: '0', - name: 'Edward King 0', - age: '32', - address: 'London, Park Lane no. 0', - }, - { - key: '1', - name: 'Edward King 1', - age: '32', - address: 'London, Park Lane no. 1', - }, -] - const App = () => { - const [dataSource, setDataSource] = useState(initialData); + const [dataSource, setDataSource] = useState([ + { + key: '0', + name: 'Edward King 0', + age: '32', + address: 'London, Park Lane no. 0', + }, + { + key: '1', + name: 'Edward King 1', + age: '32', + address: 'London, Park Lane no. 1', + }, + ]); const [count, setCount] = useState(2); const handleDelete = (key) => { const newData = dataSource.filter((item) => item.key !== key); setDataSource(newData); }; - const defaultColumns = [ { title: 'Course Title', @@ -131,7 +127,6 @@ const App = () => { ) : null, }, ]; - const handleAdd = () => { const newData = { key: count, @@ -142,7 +137,6 @@ const App = () => { setDataSource([...dataSource, newData]); setCount(count + 1); }; - const handleSave = (row) => { const newData = [...dataSource]; const index = newData.findIndex((item) => row.key === item.key);