mirror of
https://github.com/ccmjga/zhilu-admin
synced 2026-03-27 22:03:42 +08:00
init minio
This commit is contained in:
@@ -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,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user