fix(auth-web): handle verify-email token links and show auth feedback
Some checks failed
CI / test (push) Failing after 1m56s
Some checks failed
CI / test (push) Failing after 1m56s
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import axios from "axios";
|
||||
import { FormEvent, useState } from "react";
|
||||
import { FormEvent, useEffect, useState } from "react";
|
||||
import { checkEmailStatus, registerRequest } from "../api/auth";
|
||||
import { useAuthStore } from "../store/authStore";
|
||||
|
||||
type Step = "email" | "password" | "register" | "otp";
|
||||
const AUTH_NOTICE_KEY = "bm_auth_notice";
|
||||
|
||||
export function AuthPanel() {
|
||||
const login = useAuthStore((s) => s.login);
|
||||
@@ -20,6 +21,15 @@ export function AuthPanel() {
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [success, setSuccess] = useState<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const notice = window.localStorage.getItem(AUTH_NOTICE_KEY);
|
||||
if (!notice) {
|
||||
return;
|
||||
}
|
||||
setSuccess(notice);
|
||||
window.localStorage.removeItem(AUTH_NOTICE_KEY);
|
||||
}, []);
|
||||
|
||||
async function onSubmit(event: FormEvent) {
|
||||
event.preventDefault();
|
||||
setError(null);
|
||||
|
||||
Reference in New Issue
Block a user