// Register
  const handleSubmit = async (e) => {
    e.preventDefault();
    try {
      setLoading(true);
      // console.log(email, password);
      const { data } = await axios.post(`/pre-register`, {
        email,
        password,
      });
      // console.log(data);
      if (data?.error) {
        toast.error(data?.error);
        setLoading(false);
      } else {
        setLoading(true);
        toast.success("Please check your email to complete registration");
      }
    } catch (err) {
      console.log(err);
      setLoading(false);
      toast.error("Something went wrong. Try again.");
    }
  };

Now show loading status on the button.

<button
  className="btn btn-primary col-12 mb-4"
  disabled={loading}
>
  {loading ? "Waiting..." : "Login"}
</button>

Redirect user to home page after success response

// import
import { useNavigate } from "react-router-dom";

const navigate = useNavigate();

// in axios
setAuth(data);
setLoading(true);
toast.success("Please check your email to complete registration");
navigate("/");