diff --git a/db_app/src/App.js b/db_app/src/App.js
index e5fc508..2793609 100644
--- a/db_app/src/App.js
+++ b/db_app/src/App.js
@@ -12,7 +12,7 @@ import {
useNavigate,
} from 'react-router-dom';
-ReactSession.setStoreType("localStorage");
+ReactSession.setStoreType("sessionStorage");
function App() {
diff --git a/db_app/src/components/Login.js b/db_app/src/components/Login.js
index 6411062..c6048ff 100644
--- a/db_app/src/components/Login.js
+++ b/db_app/src/components/Login.js
@@ -34,6 +34,10 @@ export function Login() {
navigate('/CreateAccount');
}
+ const navigateHome = () => {
+ navigate('/Plan');
+ }
+
const [data,setData] = useState({
net_id:"",
password:""
@@ -50,11 +54,12 @@ const [data,setData] = useState({
console.log(data);
console.log(net_id[0])
login();
- ReactSession.set("username", net_id[0]);
- ReactSession.set("password", password[0]);
+
}
-
+const setSession = () => {
+ ReactSession.set("net_id", net_id[0]);
+}
const getHello = () => {
@@ -66,7 +71,12 @@ const getHello = () => {
const login = () => {
Axios.post("http://3.219.93.142:8000/api/auth", {net_id: net_id[0], password: password[0],}).then((response) => {
console.log(response);
- console.log(response.status)
+ console.log(response.status);
+ if (response.status === 200){
+ setSession();
+ navigateHome();
+ }
+
});
};
diff --git a/db_app/src/components/Plan.js b/db_app/src/components/Plan.js
index c09ff4f..24ced48 100644
--- a/db_app/src/components/Plan.js
+++ b/db_app/src/components/Plan.js
@@ -21,7 +21,7 @@ import MenuIcon from '@mui/material/Menu'
import MenuItem from '@mui/material/MenuItem';
import {red, green, lightBlue, lightGreen} from '@mui/material/colors';
import { ThemeProvider, createTheme } from '@mui/material/styles';
-
+import { ReactSession } from 'react-client-session';
@@ -50,6 +50,12 @@ function MyPlan() {
}
const navigateLogin = () => {
navigate('/');
+}
+
+const logout = () => {
+ ReactSession.set("net_id", "");
+ navigateLogin();
+
}
return (
@@ -67,7 +73,7 @@ const navigateLogin = () => {
-