avatar profile
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
import { api } from "@/config/axios";
|
||||
import { GetProfileResponse, UpdateProfileType } from "../types/Types";
|
||||
import {
|
||||
GetProfileResponse,
|
||||
SingleUploadResponse,
|
||||
UpdateProfileType,
|
||||
} from "../types/Types";
|
||||
|
||||
export const getProfile = async (): Promise<GetProfileResponse> => {
|
||||
const { data } = await api.get<GetProfileResponse>("/public/user/me");
|
||||
@@ -10,3 +14,20 @@ 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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user