feat: Oauth update

This commit is contained in:
landaiqing
2024-05-27 00:00:57 +08:00
parent 7f68128b5e
commit e564264c4d
10 changed files with 340 additions and 305 deletions

View File

@@ -20,6 +20,7 @@ import { observer } from "mobx-react";
import FooterComponent from "@/components/Footer";
import RotateCaptcha, { CaptchaInstance } from "react-rotate-captcha";
import { get, load, verify } from "@/api/captcha/index.ts";
import { oauthLogin } from "@/api/user";
// import useStore from '@/utils/store/useStore.tsx'
type LoginType = "account" | "phone";
@@ -53,6 +54,12 @@ export default observer(() => {
key: "phone",
},
];
async function oAuthLogin(type: string) {
const res: any = await oauthLogin(type);
window.location.href = res.data;
}
const [loginType, setLoginType] = useState<LoginType>("account");
const onSubmit = async (formData: object) => {
@@ -359,6 +366,9 @@ export default observer(() => {
borderRadius: "50%",
}}>
<GitlabOutlined
onClick={() => {
oAuthLogin("GITEE").then();
}}
style={{ ...iconStyles, color: "#FF6A10" }}
/>
</div>