feat: magic link login/reg

This commit is contained in:
zerosoul
2022-05-09 21:17:49 +08:00
parent f3b82295d6
commit 1b1cfb956e
16 changed files with 760 additions and 350 deletions
+42
View File
@@ -0,0 +1,42 @@
/* eslint-disable no-undef */
import { useState, useEffect } from "react";
// import { useDispatch } from "react-redux";
// import { useNavigate } from "react-router-dom";
import toast from "react-hot-toast";
import Input from "../../common/component/styled/Input";
import Button from "../../common/component/styled/Button";
// import { useSendMagicLinkMutation } from "../../app/services/auth";
export default function Reg() {
// const [
// sendMagicLink,
// { data, isSuccess, isLoading, error },
// ] = useSendMagicLinkMutation();
// const navigateTo = useNavigate();
// const dispatch = useDispatch();
const [username, setUsername] = useState("");
const handleLogin = (evt) => {
evt.preventDefault();
// sendMagicLink(email);
};
const handleInput = (evt) => {
const { value } = evt.target;
console.log(value);
setUsername(value);
};
return (
<form onSubmit={handleLogin}>
<Input
className="large"
name="username"
value={username}
required
placeholder="Enter your Name22"
onChange={handleInput}
/>
<Button type="submit">{isLoading ? "Sending" : `Register`}</Button>
</form>
);
}