Files
dmenu-plus-front/src/app/[name]/(Profile)/profile/service/ProfileService.ts
T
hamid zarghami 22433bac5e avatar profile
2025-12-14 11:51:37 +03:30

34 lines
804 B
TypeScript

import { api } from "@/config/axios";
import {
GetProfileResponse,
SingleUploadResponse,
UpdateProfileType,
} from "../types/Types";
export const getProfile = async (): Promise<GetProfileResponse> => {
const { data } = await api.get<GetProfileResponse>("/public/user/me");
return data;
};
export const updateProfile = async (params: UpdateProfileType) => {
const { data } = await api.patch("/public/user/update", params);
return data;
};
export const singleUpload = async (
file: File
): Promise<SingleUploadResponse> => {
const formData = new FormData();
formData.append("file", file);
const { data } = await api.post<SingleUploadResponse>(
`/public/single-file`,
formData,
{
headers: {
"Content-Type": undefined,
},
}
);
return data;
};