This commit is contained in:
2026-03-16 23:31:28 +01:00
parent ed18993aeb
commit 30e69ccbb3
4 changed files with 5 additions and 538 deletions

View File

@@ -1,6 +1,5 @@
import { useEffect, useState} from "react";
import { useEffect, useState, type SubmitEvent } from "react";
import { useSearchParams, Link } from "react-router-dom";
import * as React from "react";
function saveTokensAndRedirect(token: string, refreshToken: string, redirect: string) {
localStorage.setItem("token", token);
@@ -26,7 +25,7 @@ export default function LoginPage() {
}
}, [searchParams, redirect]);
async function handleSubmit(e: React.SyntheticEvent<HTMLFormElement>) {
async function handleSubmit(e: SubmitEvent<HTMLFormElement>) {
e.preventDefault();
setError("");
setLoading(true);

View File

@@ -1,4 +1,4 @@
import { useState, FormEvent } from "react";
import { useState, type SubmitEvent } from "react";
import { useSearchParams, Link } from "react-router-dom";
function saveTokensAndRedirect(token: string, refreshToken: string, redirect: string) {
@@ -18,7 +18,7 @@ export default function RegisterPage() {
const [error, setError] = useState("");
const [loading, setLoading] = useState(false);
async function handleSubmit(e: FormEvent) {
async function handleSubmit(e: SubmitEvent<HTMLFormElement>) {
e.preventDefault();
setError("");
@@ -32,7 +32,7 @@ export default function RegisterPage() {
const res = await fetch("/api/auth/register", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ username, email, password }),
body: JSON.stringify({ username, email, password, confirmPassword }),
});
const data = await res.json();
if (data.success && data.payload?.token) {