Feat: extract user api

This commit is contained in:
Lazy 2023-08-31 12:04:08 +08:00
parent 3af138d2fe
commit 3994e69cc7
3 changed files with 36 additions and 35 deletions

View File

@ -3,7 +3,7 @@ import { t } from "@/lang/i18n";
import { useAppStateStore } from "@/stores/useAppStateStore";
import { useAppToolsStore } from "@/stores/useAppToolsStore";
import { reactive, ref } from "vue";
import { setUserApiKey, updatePassword } from "@/services/apis";
import { setUserApiKey, updatePassword } from "@/services/apis/user";
import { message } from "ant-design-vue";
import type { FormInstance } from "ant-design-vue";
import CopyButton from "@/components/CopyButton.vue";

View File

@ -7,12 +7,12 @@ import type { BaseUserInfo } from "@/types/user";
// 用户登录
export const loginUser = useDefineApi<
| {
// Post
data: {
username: string;
password: string;
};
}
// Post
data: {
username: string;
password: string;
};
}
| undefined,
// Response
{
@ -61,37 +61,11 @@ export const settingInfo = useDefineApi<any, Settings>({
// 提交设置信息
export const setSettingInfo = useDefineApi<
| {
data: Settings;
}
data: Settings;
}
| undefined,
string
>({
url: "/api/overview/setting",
method: "PUT"
});
// 设置用户APIKey
export const setUserApiKey = useDefineApi<
{
data: {
enable: boolean;
};
},
string
>({
url: "/api/auth/api",
method: "PUT"
});
// 更新密码
export const updatePassword = useDefineApi<
{
data: {
passWord: string;
};
},
boolean
>({
url: "/api/auth/update",
method: "PUT"
});

View File

@ -0,0 +1,27 @@
import { useDefineApi } from "@/stores/useDefineApi";
// 设置用户APIKey
export const setUserApiKey = useDefineApi<
{
data: {
enable: boolean;
};
},
string
>({
url: "/api/auth/api",
method: "PUT"
});
// 更新密码
export const updatePassword = useDefineApi<
{
data: {
passWord: string;
};
},
boolean
>({
url: "/api/auth/update",
method: "PUT"
});