diff --git a/src/components/Low/Input.tsx b/src/components/Low/Input.tsx
index 3ea53ddf..7bbfb796 100644
--- a/src/components/Low/Input.tsx
+++ b/src/components/Low/Input.tsx
@@ -5,11 +5,12 @@ interface Props {
required?: boolean;
label?: string;
placeholder?: string;
+ defaultValue?: string;
name: string;
onChange: (value: string) => void;
}
-export default function Input({type, label, placeholder, name, required = false, onChange}: Props) {
+export default function Input({type, label, placeholder, name, required = false, defaultValue, onChange}: Props) {
const [showPassword, setShowPassword] = useState(false);
if (type === "password") {
@@ -55,6 +56,7 @@ export default function Input({type, label, placeholder, name, required = false,
placeholder={placeholder}
className="px-8 py-6 text-sm font-normal placeholder:text-mti-gray-cool bg-white rounded-full border border-mti-gray-platinum focus:outline-none"
required={required}
+ defaultValue={defaultValue}
/>
);
diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx
index 09d5aa8a..f68581ff 100644
--- a/src/components/Navbar.tsx
+++ b/src/components/Navbar.tsx
@@ -1,4 +1,5 @@
import {User} from "@/interfaces/user";
+import Link from "next/link";
import {Avatar} from "primereact/avatar";
interface Props {
@@ -12,10 +13,10 @@ export default function Navbar({user}: Props) {
eCrop
-
+
{user.name}
-
+
);
diff --git a/src/interfaces/user.ts b/src/interfaces/user.ts
index 36718040..def62352 100644
--- a/src/interfaces/user.ts
+++ b/src/interfaces/user.ts
@@ -11,6 +11,7 @@ export interface User {
levels: {[key in Module]: number};
desiredLevels: {[key in Module]: number};
type: Type;
+ bio: string;
}
export interface Stat {
diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx
index 0875bf16..d9122cc7 100644
--- a/src/pages/_app.tsx
+++ b/src/pages/_app.tsx
@@ -15,9 +15,7 @@ export default function App({Component, pageProps}: AppProps) {
const router = useRouter();
useEffect(() => {
- if (router.pathname !== "/exam") {
- reset();
- }
+ reset();
}, [router.pathname, reset]);
return ;
diff --git a/src/pages/api/user.ts b/src/pages/api/user.ts
index 4645bf8a..139efffa 100644
--- a/src/pages/api/user.ts
+++ b/src/pages/api/user.ts
@@ -12,6 +12,12 @@ const db = getFirestore(app);
export default withIronSessionApiRoute(user, sessionOptions);
async function user(req: NextApiRequest, res: NextApiResponse) {
+ if (req.method === "GET") return get(req, res);
+
+ res.status(404).json(undefined);
+}
+
+async function get(req: NextApiRequest, res: NextApiResponse) {
if (req.session.user) {
const docUser = await getDoc(doc(db, "users", req.session.user.id));
if (!docUser.exists()) {
diff --git a/src/pages/login.tsx b/src/pages/login.tsx
index 65410776..9822af62 100644
--- a/src/pages/login.tsx
+++ b/src/pages/login.tsx
@@ -7,14 +7,15 @@ import Head from "next/head";
import useUser from "@/hooks/useUser";
import {Divider} from "primereact/divider";
import Button from "@/components/Low/Button";
-import {BsArrowRepeat} from "react-icons/bs";
+import {BsArrowRepeat, BsCheck} from "react-icons/bs";
import Link from "next/link";
import Input from "@/components/Low/Input";
+import clsx from "clsx";
export default function Login() {
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
- const [showPassword, setShowPassword] = useState(false);
+ const [rememberPassword, setRememberPassword] = useState(false);
const [isLoading, setIsLoading] = useState(false);
const {mutateUser} = useUser({
@@ -65,6 +66,23 @@ export default function Login() {