diff --git a/backend/dist/auth/auth.controller.js b/backend/dist/auth/auth.controller.js
index c922ad75..d6c91c61 100644
--- a/backend/dist/auth/auth.controller.js
+++ b/backend/dist/auth/auth.controller.js
@@ -1,5 +1,4 @@
"use strict";
-// src/auth/auth.controller.ts
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index 87a4e68a..c0fd4aae 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -4695,6 +4695,32 @@
"url": "https://opencollective.com/mobx"
}
},
+ "node_modules/mobx-react": {
+ "version": "9.2.0",
+ "resolved": "https://registry.npmjs.org/mobx-react/-/mobx-react-9.2.0.tgz",
+ "integrity": "sha512-dkGWCx+S0/1mfiuFfHRH8D9cplmwhxOV5CkXMp38u6rQGG2Pv3FWYztS0M7ncR6TyPRQKaTG/pnitInoYE9Vrw==",
+ "license": "MIT",
+ "peer": true,
+ "dependencies": {
+ "mobx-react-lite": "^4.1.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/mobx"
+ },
+ "peerDependencies": {
+ "mobx": "^6.9.0",
+ "react": "^16.8.0 || ^17 || ^18 || ^19"
+ },
+ "peerDependenciesMeta": {
+ "react-dom": {
+ "optional": true
+ },
+ "react-native": {
+ "optional": true
+ }
+ }
+ },
"node_modules/mobx-react-lite": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/mobx-react-lite/-/mobx-react-lite-4.1.0.tgz",
diff --git a/frontend/src/Account.tsx b/frontend/src/Account.tsx
new file mode 100644
index 00000000..4fd81e56
--- /dev/null
+++ b/frontend/src/Account.tsx
@@ -0,0 +1,57 @@
+import { observer } from "mobx-react-lite";
+import { useAuthContext } from "./context/auth/authContext";
+import { logoutUser } from "./external/bcanSatchel/actions";
+import Profile from "./Profile";
+import { Link } from "react-router-dom";
+
+const Account = observer(() => {
+ const { user } = useAuthContext();
+
+ const handleLogout = () => {
+ logoutUser();
+ };
+
+ return (
+
+
+
+
+
+
+
+
Welcome, {user?.userId}
+
+
+
+ );
+});
+
+export default Account;
diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx
index 2df83575..408fdb73 100644
--- a/frontend/src/App.tsx
+++ b/frontend/src/App.tsx
@@ -1,51 +1,56 @@
-import './App.css';
+import "./App.css";
// Components
-import Login from './Login';
-import Register from './Register';
-import Dashboard from './Dashboard';
+import Login from "./Login";
+import Register from "./Register";
+import Account from "./Account.tsx";
import GrantPage from "./grant-info/components/GrantPage.tsx";
// Libraries
-import { ChakraProvider, defaultSystem } from "@chakra-ui/react"
-import { BrowserRouter as Router, Route, Routes, Navigate } from 'react-router-dom';
-import { observer } from 'mobx-react-lite';
+import { ChakraProvider, defaultSystem } from "@chakra-ui/react";
+import {
+ BrowserRouter as Router,
+ Route,
+ Routes,
+ Navigate,
+} from "react-router-dom";
+import { observer } from "mobx-react-lite";
// Register store and mutators
-import './external/bcanSatchel/mutators';
-import { useAuthContext } from './context/auth/authContext';
-
+import "./external/bcanSatchel/mutators";
+import { useAuthContext } from "./context/auth/authContext";
const App = observer(() => {
- const { isAuthenticated } = useAuthContext()
+ const { isAuthenticated } = useAuthContext();
return (
- < div className="app-container">
-
- : }
- />
- : }
- />
- : }
- />
- }
- />
- }
- />
-
-
+
+
+ : }
+ />
+ :
+ }
+ />
+ : }
+ />
+ } />
+
+ }
+ />
+
+
);
});
-export default App;
\ No newline at end of file
+export default App;
diff --git a/frontend/src/Dashboard.tsx b/frontend/src/Dashboard.tsx
deleted file mode 100644
index fe1af10a..00000000
--- a/frontend/src/Dashboard.tsx
+++ /dev/null
@@ -1,32 +0,0 @@
-import { observer } from 'mobx-react-lite';
-import { useAuthContext } from './context/auth/authContext';
-import { logoutUser } from './external/bcanSatchel/actions';
-import Profile from './Profile';
-
-const Dashboard = observer(() => {
- const { user } = useAuthContext();
-
- const handleLogout = () => {
- logoutUser();
- };
-
- return (
-
-
-
-
Welcome, {user?.userId}
-
-
-
- );
-});
-
-export default Dashboard;
\ No newline at end of file
diff --git a/frontend/src/Login.tsx b/frontend/src/Login.tsx
index fc5aeac6..16a39552 100644
--- a/frontend/src/Login.tsx
+++ b/frontend/src/Login.tsx
@@ -1,70 +1,86 @@
-import React, { useState } from 'react';
-import { useAuthContext } from './context/auth/authContext'
-import { observer } from 'mobx-react-lite';
-import { useNavigate } from 'react-router-dom';
-import './external/bcanSatchel/mutators';
+import React, { useState } from "react";
+import { useAuthContext } from "./context/auth/authContext";
+import { observer } from "mobx-react-lite";
+import { useNavigate } from "react-router-dom";
+import "./external/bcanSatchel/mutators";
const Login = observer(() => {
- const [username, setUsername] = useState('');
- const [password, setPassword] = useState('');
+ const [username, setUsername] = useState("");
+ const [password, setPassword] = useState("");
const navigate = useNavigate();
const { login } = useAuthContext();
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();
try {
- await login(username, password);
- navigate('/dashboard');
+ await login(username, password);
+ navigate("/account");
} catch (error) {
- console.error('Error during login:', error);
- alert('An error occurred while logging in. Please try again later.');
+ console.error("Error during login:", error);
+ alert("An error occurred while logging in. Please try again later.");
}
};
return (
-
);
});
-export default Login;
\ No newline at end of file
+export default Login;
diff --git a/frontend/src/Profile.tsx b/frontend/src/Profile.tsx
index 2520b8bc..0e32243a 100644
--- a/frontend/src/Profile.tsx
+++ b/frontend/src/Profile.tsx
@@ -1,59 +1,63 @@
-import React, { useState } from 'react';
-import { observer } from 'mobx-react-lite';
-import { useAuthContext } from './context/auth/authContext';
-import { updateUserProfile } from './external/bcanSatchel/actions';
+import React, { useState } from "react";
+import { observer } from "mobx-react-lite";
+import { useAuthContext } from "./context/auth/authContext";
+import { updateUserProfile } from "./external/bcanSatchel/actions";
const Profile = observer(() => {
const { user } = useAuthContext();
- const [email, setEmail] = useState(user?.email || '');
- const [biography, setBiography] = useState(user?.biography || '');
+ const [email, setEmail] = useState(user?.email || "");
+ const [biography, setBiography] = useState(user?.biography || "");
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();
try {
- const response = await fetch('http://localhost:3001/user/me', {
- method: 'PUT',
+ const response = await fetch("http://localhost:3001/user/me", {
+ method: "PUT",
headers: {
- 'Content-Type': 'application/json',
- Authorization: `Bearer ${user?.accessToken ?? ''}`,
+ "Content-Type": "application/json",
+ Authorization: `Bearer ${user?.accessToken ?? ""}`,
},
body: JSON.stringify({ email, biography }),
});
if (!response.ok) {
const errorData = await response.json();
- alert(errorData.message || 'Failed to update profile.');
+ alert(errorData.message || "Failed to update profile.");
return;
}
const data = await response.json();
updateUserProfile(data);
- alert('Profile updated successfully.');
+ alert("Profile updated successfully.");
} catch (error) {
- console.error('Error updating profile:', error);
- alert('An error occurred while updating your profile.');
+ console.error("Error updating profile:", error);
+ alert("An error occurred while updating your profile.");
}
};
return (
-