Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
huangrandy committed Jan 14, 2024
2 parents 89eda7f + 646b689 commit f1c579e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 25 deletions.
25 changes: 20 additions & 5 deletions src/components/Dashboard/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ function Dashboard() {
const handleClose = () => {
setSignup(false);
};
let [logoutUser, setLogout] = useState(false);



Expand All @@ -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 = [
Expand Down Expand Up @@ -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");


Expand Down Expand Up @@ -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);
}
});
Expand Down Expand Up @@ -466,7 +479,9 @@ function Dashboard() {
label: "Logout",
onClick: () => {
logout();
navigate("/");
setLogout(true);


}

}
Expand Down
34 changes: 14 additions & 20 deletions src/components/Table/Table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,30 +77,26 @@ const EditableCell = ({
}
return <td {...restProps}>{childNode}</td>;
};

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',
Expand Down Expand Up @@ -131,7 +127,6 @@ const App = () => {
) : null,
},
];

const handleAdd = () => {
const newData = {
key: count,
Expand All @@ -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);
Expand Down

0 comments on commit f1c579e

Please sign in to comment.