diff --git a/client/app.tsx b/client/app.tsx
index 7b79654..f03bd64 100644
--- a/client/app.tsx
+++ b/client/app.tsx
@@ -52,10 +52,20 @@ export function App() {
}, [])
if (route === "login") {
- return
+ return (
+ <>
+
+
+ >
+ )
}
- return
+ return (
+ <>
+
+
+ >
+ )
}
export function NTS() {
@@ -371,7 +381,6 @@ export function NTS() {
setIsShowingHelp(false)} />
-
>
)
}
diff --git a/client/login.tsx b/client/login.tsx
index 316d807..91284a6 100644
--- a/client/login.tsx
+++ b/client/login.tsx
@@ -1,8 +1,9 @@
-import { useCallback } from "react"
+import { type FormEvent, useCallback } from "react"
import { electron } from "./electron"
import css from "./login.module.css"
+import { notify } from "./notifications"
type LoginProps = {
onClose: () => void
@@ -12,7 +13,9 @@ export function Login(props: LoginProps) {
const { onClose } = props
const handleSubmit = useCallback(
- async function (data: FormData) {
+ async function (evt: FormEvent) {
+ evt.preventDefault()
+ const data = new FormData(evt.target as HTMLFormElement)
const email = data.get("email")?.toString() ?? null
const password = data.get("password")?.toString() ?? null
@@ -24,16 +27,14 @@ export function Login(props: LoginProps) {
await electron.invoke("login-credentials", { email, password })
onClose()
} catch (err) {
- // TODO: show error
- console.log("HERE", err)
+ notify({ message: "invalid credentials", ttl: 4000, type: "error" })
}
},
[onClose],
)
return (
- // @ts-expect-error: form action type is not a string
-