diff --git a/frontend-v2/src/pages/login.tsx b/frontend-v2/src/pages/login.tsx index 26699d24e..f0da18fff 100644 --- a/frontend-v2/src/pages/login.tsx +++ b/frontend-v2/src/pages/login.tsx @@ -15,6 +15,75 @@ import { useMutation } from "@tanstack/react-query"; import { client } from "@main"; import { ThemeToggle } from "@ui/theme"; +export const Signup = ({ setSignup }: { setSignup: (f: false) => void }) => { + // const { refetch } = useRead("GetUser", {}); + const [creds, set] = useState({ username: "", password: "" }); + const { mutateAsync, isLoading } = useMutation( + (creds: { username: string; password: string }) => + client.auth({ + type: "CreateLocalUser", + params: creds, + }) + ); + + const signup = async () => { + const { jwt } = await mutateAsync(creds); + localStorage.setItem("monitor-auth-token", jwt); + location.reload(); + }; + + return ( +