init minio

This commit is contained in:
Chuck1sn
2025-06-15 15:09:52 +08:00
parent c64f2eb0f6
commit dc7780e0a8
28 changed files with 333 additions and 25 deletions

View File

@@ -1,20 +1,35 @@
import { ref } from "vue";
import client from "../../api/client";
import type { UserUpsertSubmitModel } from "../../types/user";
export const useUserUpsert = () => {
const uploadUserAvatar = async (file: File) => {
const { data } = await client.POST("/iam/avatar/upload", {
body: {
file: file as unknown as string,
},
bodySerializer: (body) => {
const formData = new FormData();
formData.set("file", body?.file as unknown as string);
return formData;
},
parseAs: "text",
});
return data;
};
const upsertUser = async (user: UserUpsertSubmitModel) => {
const { data } = await client.POST("/iam/user", {
await client.POST("/iam/user", {
body: {
id: user.id,
username: user.username,
password: user.password,
enable: user.enable,
avatar: user.avatar,
},
});
};
return {
uploadUserAvatar,
upsertUser,
};
};