diff --git a/frontend/src/contexts/AuthContext.tsx b/frontend/src/contexts/AuthContext.tsx
index 4b34852..68bc566 100644
--- a/frontend/src/contexts/AuthContext.tsx
+++ b/frontend/src/contexts/AuthContext.tsx
@@ -30,14 +30,17 @@ export function useAuth() {
}
export function AuthProvider({ children }: { children: ReactElement }) {
- const [user, setUser] = useState
(null);
-
- const login = useCallback((name: string, pass: string) => {
- setUser({
- name: name,
- pass: pass,
- });
- }, [setUser]);
+ const [user, setUser] = useState(null);
+
+ const login = useCallback(
+ (name: string, pass: string) => {
+ setUser({
+ name: name,
+ pass: pass,
+ });
+ },
+ [setUser]
+ );
const logout = useCallback(() => {
setUser(null);
diff --git a/frontend/src/library/button.tsx b/frontend/src/library/button.tsx
index af848eb..add3958 100644
--- a/frontend/src/library/button.tsx
+++ b/frontend/src/library/button.tsx
@@ -15,7 +15,7 @@ type ButtonProps = {
fontSize?: string;
rounded?: string;
buttonSize?: string;
- type?: "submit" | "reset" | "button"
+ type?: 'submit' | 'reset' | 'button';
borderColor?: string;
hoverColor?: string;
hoverScale?: boolean;
diff --git a/frontend/src/pages/Login.tsx b/frontend/src/pages/Login.tsx
index a0d2e52..6a51c94 100644
--- a/frontend/src/pages/Login.tsx
+++ b/frontend/src/pages/Login.tsx
@@ -14,8 +14,8 @@ const Login: React.FC = () => {
const [username, setUsername] = useState('');
const navigate = useNavigate();
const auth = useAuth();
- const user = auth.getUser();
-
+ const user = auth.getUser();
+
const handleLogin = () => {
setUsername(username);
console.log(auth.isLoggedIn());
@@ -30,38 +30,39 @@ const Login: React.FC = () => {
setName(event.target.value);
};
- const handlePasswordChange = (event: React.ChangeEvent) => {
+ const handlePasswordChange = (
+ event: React.ChangeEvent
+ ) => {
setPassword(event.target.value);
};
-
const handleSubmit = (event: React.FormEvent) => {
event.preventDefault();
console.log('Form submitted');
- if(user?.name == name && user.pass == password){
- console.log("Successful Login");
+ if (user?.name == name && user.pass == password) {
+ console.log('Successful Login');
navigate('/home');
- }else{
- console.log("Failed Login");
+ } else {
+ console.log('Failed Login');
}
};
useEffect(() => {
setIsLoggedIn(auth.isLoggedIn());
console.log(isLoggedIn);
- }, [auth, auth.getUser(), auth.isLoggedIn()]);
+ }, [auth, auth.getUser(), isLoggedIn]);
return (
<>
-