feat(auth): add registration message for successful registration #4

Merged
shafin808s merged 1 commits from web into main 2026-03-12 07:53:00 +00:00
2 changed files with 22 additions and 3 deletions

View File

@ -313,6 +313,13 @@ const STYLES = `
display:flex;align-items:center;gap:0.5rem; display:flex;align-items:center;gap:0.5rem;
} }
.lg-success {
background:#f0fdf4;border:2px solid #bbf7d0;border-radius:14px;padding:0.8rem 1rem;
font-family:'Nunito Sans',sans-serif;font-size:0.82rem;font-weight:700;color:#15803d;
display:flex;align-items:center;gap:0.5rem;
animation: formPop 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
}
.lg-btn { .lg-btn {
width:100%;padding:1rem;background:#f97316;color:white;border:none;border-radius:100px;cursor:pointer; width:100%;padding:1rem;background:#f97316;color:white;border:none;border-radius:100px;cursor:pointer;
font-family:'Nunito',sans-serif;font-size:1rem;font-weight:900; font-family:'Nunito',sans-serif;font-size:1rem;font-weight:900;
@ -365,8 +372,14 @@ export const Login = () => {
const navigate = useNavigate(); const navigate = useNavigate();
const location = useLocation(); const location = useLocation();
const { login, isAuthenticated, isLoading, error, clearError } = const {
useAuthStore(); login,
isAuthenticated,
isLoading,
error,
clearError,
registrationMessage,
} = useAuthStore();
const from = const from =
(location.state as LocationState)?.from?.pathname || "/student/home"; (location.state as LocationState)?.from?.pathname || "/student/home";
@ -673,6 +686,12 @@ export const Login = () => {
</label> </label>
</div> </div>
{registrationMessage && (
<div className="lg-success">
<span></span> {registrationMessage}
</div>
)}
{error && ( {error && (
<div className="lg-error"> <div className="lg-error">
<span></span> {error} <span></span> {error}

View File

@ -758,7 +758,7 @@ export const Register = () => {
avatar_url: avatarUrl, avatar_url: avatarUrl,
password, password,
}); });
if (success) navigate("/student/home", { replace: true }); if (success) navigate("/login", { replace: true });
}; };
return ( return (