2
0

fix: 注册功能接口变更

This commit is contained in:
TsMask
2024-11-30 17:31:47 +08:00
parent 8f198f789d
commit 5e54aaf24d
5 changed files with 231 additions and 213 deletions

View File

@@ -7,7 +7,7 @@ import { localStg } from '@/utils/storage';
import { $t } from '@/locales';
import { useRouteStore } from '../route';
import { clearAuthStorage, emptyInfo, getToken } from './shared';
import {doCheckUserRepeat, sendCaptcha} from "@/service/api/auth";
import { doCheckUserRepeat, sendCaptcha } from '@/service/api/auth';
export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
const routeStore = useRouteStore();
@@ -122,12 +122,11 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
}
return false;
}
//check User
/**
* 检查用户信息是否已存在
*/
async function checkUserRepeat(checkForm:Api.Auth.CheckBody) {
async function checkUserRepeat(checkForm: Api.Auth.CheckBody) {
const { data, error } = await doCheckUserRepeat(checkForm);
return { exists: data, error };
}
@@ -149,16 +148,13 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
endLoading();
return !error;
}
async function captcha(email:string){
async function captcha(email: string) {
if (!email) {
return;
}
try {
await sendCaptcha({ email }); // 这里调用后端接口发送验证码
} catch (error) {
return null;
}
const { data, error } = await sendCaptcha({ email }); // 这里调用后端接口发送验证码
return { data, error };
}
return {
@@ -173,6 +169,6 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
refreshUserInfo,
register,
captcha,
checkUserRepeat,
checkUserRepeat
};
});