feat: google auth

This commit is contained in:
archer
2023-05-24 14:37:01 +08:00
parent 116e9c8d85
commit c99d6998ea
16 changed files with 150 additions and 151 deletions

View File

@@ -3,8 +3,13 @@ import { sendAuthCode } from '@/api/user';
import { UserAuthTypeEnum } from '@/constants/common';
let timer: any;
import { useToast } from './useToast';
import { getClientToken } from '@/utils/plugin/google';
import { useGlobalStore } from '@/store/global';
export const useSendCode = () => {
const {
initData: { googleVerKey }
} = useGlobalStore();
const { toast } = useToast();
const [codeSending, setCodeSending] = useState(false);
const [codeCountDown, setCodeCountDown] = useState(0);
@@ -24,7 +29,8 @@ export const useSendCode = () => {
try {
await sendAuthCode({
username,
type
type,
googleToken: await getClientToken(googleVerKey)
});
setCodeCountDown(60);
timer = setInterval(() => {