From 8e4d241014bed6036fbbc0b6a0f0d78d8fe50fe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E4=BA=9A=E6=98=95?= <1549469775@qq.com> Date: Mon, 25 Nov 2024 16:03:24 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E5=A2=9E=E5=8A=A0=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=94=A8=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/index.ts | 2 +- src/layout/base.tsx | 8 ++++++ src/ui/Login/Login.tsx | 26 +++++++++++++++++++ src/ui/Register/Register.tsx | 12 +++++---- src/views/Home/index.tsx | 62 ++++++++++++-------------------------------- 5 files changed, 59 insertions(+), 51 deletions(-) create mode 100644 src/ui/Login/Login.tsx diff --git a/src/api/index.ts b/src/api/index.ts index a768f2a..5693482 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -4,7 +4,7 @@ const client = new Client() client.setProject(import.meta.env.VUE_APPWRITE_PROJECT_ID) -export async function register(opts: { email: string; password: string }, errText: string) { +export async function apiRegister(opts: { email: string; password: string }, errText: string) { const account = new Account(client) try { await account.create(ID.unique(), opts.email, opts.password) diff --git a/src/layout/base.tsx b/src/layout/base.tsx index d9e0e88..0cb898d 100644 --- a/src/layout/base.tsx +++ b/src/layout/base.tsx @@ -6,6 +6,7 @@ import { GlobalStyles } from "./GlobalStyles" import { Notice } from "@/ui/Notice" import { Markdown } from "@/ui/Markdown" import { Register } from "@/ui/Register/Register" +import { Login } from "@/ui/Login/Login" interface PageProps { children: ReactNode @@ -28,6 +29,7 @@ function BaseLayout(props: PageProps) { const [isOpen, setIsOpen] = useState(false) const [isOpenAbout, setIsOpenAbout] = useState(false) const [isOpenRegister, setIsOpenRegister] = useState(false) + const [isOpenLogin, setIsOpenLogin] = useState(false) const router = useHistory() @@ -79,6 +81,7 @@ function BaseLayout(props: PageProps) { + -// -// -// ) -// }) - export default withPage(function Project({ }: IProps) { - const { register, handleSubmit, watch, formState: { errors } } = useForm(); - const onSubmit: SubmitHandler = data => console.log(data); - console.log(watch("example")) // watch input value by passing the name of it + const onClick = useCallback(() => { + toast.success("Wow so easy !") + // Fly.invoke().request<{a: number}>({ + // method: "get", + // url: "http://api.juheapi.com/japi/toh", + // global: false + // }).then((res) => console.log(res.data)).catch(console.log) + }, []) return ( - /* "handleSubmit" will validate your inputs before invoking "onSubmit" */ - - {/* register your input into the hook by invoking the "register" function */} - - - {/* include validation with required or other standard HTML validation rules */} - - {/* errors will return when field validation fails */} - {errors.exampleRequired && This field is required} - - - - ); + <> + + +
+ +
+ + ) })