diff --git a/src/components/UploadImage/index.tsx b/src/components/UploadImage/index.tsx index 78e1b00..baa7062 100644 --- a/src/components/UploadImage/index.tsx +++ b/src/components/UploadImage/index.tsx @@ -86,11 +86,8 @@ export default function UploadImage({ }); } - // let formData = new FormData(); const imagePath = `${pathPrefix}${imageName}.${imageMIME}`; - // formData.append('imageKey', `${pathPrefix}${imageName}.${imageMIME}`); - // formData.append('image', images[0], images[0].name); - // const uploadRes = await uploadStatic(formData); + const uploadRes = await uploadToCOS({ pathKey: imagePath, file: images[0], diff --git a/src/pages/auth/index.tsx b/src/pages/auth/index.tsx index 59e4ca7..c6947bb 100644 --- a/src/pages/auth/index.tsx +++ b/src/pages/auth/index.tsx @@ -1,26 +1,26 @@ -import useAuthStore from "@/stores/auth"; -import { useMutation } from "@tanstack/react-query"; -import { useForm } from "@mantine/form"; +import useAuthStore from '@/stores/auth'; +import { useMutation } from '@tanstack/react-query'; +import { useForm } from '@mantine/form'; -import { login as loginFn } from "@/api/auth"; -import { notifications } from "@mantine/notifications"; -import { useNavigate } from "react-router-dom"; -import { Button, TextInput } from "@mantine/core"; +import { login as loginFn } from '@/api/auth'; +import { notifications } from '@mantine/notifications'; +import { useNavigate } from 'react-router-dom'; +import { Button, TextInput } from '@mantine/core'; export default function Auth() { const { login, refreshToken } = useAuthStore(); const navigate = useNavigate(); const form = useForm({ - mode: "uncontrolled", + mode: 'uncontrolled', initialValues: { - email: "", - password: "", + email: '', + password: '', }, validate: { - email: (value) => (/^\S+@\S+$/.test(value) ? null : "Invalid email"), - password: (value) => (value.length < 6 ? "密码长度至少为6位" : null), + email: (value) => (/^\S+@\S+$/.test(value) ? null : 'Invalid email'), + password: (value) => (value.length < 6 ? '密码长度至少为6位' : null), }, }); @@ -29,9 +29,9 @@ export default function Auth() { onSuccess: (data) => { login(data.user); refreshToken(data.token); - navigate("/dashboard"); + navigate('/dashboard'); notifications.show({ - message: "登录成功", + message: '登录成功', }); }, }); @@ -54,7 +54,6 @@ export default function Auth() {