mirror of
https://github.com/MCSManager/MCSManager.git
synced 2024-12-09 07:30:04 +08:00
Feat: extract user api
This commit is contained in:
parent
3af138d2fe
commit
3994e69cc7
@ -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";
|
||||
|
@ -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"
|
||||
});
|
27
frontend/src/services/apis/user.ts
Normal file
27
frontend/src/services/apis/user.ts
Normal 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"
|
||||
});
|
Loading…
Reference in New Issue
Block a user