create category

This commit is contained in:
hamid zarghami
2026-01-24 11:08:39 +03:30
parent 6948af8b05
commit 13db24d13b
10 changed files with 203 additions and 5 deletions
+8
View File
@@ -0,0 +1,8 @@
import { useMutation } from "@tanstack/react-query";
import * as api from "../service/UploaderService";
export const useSingleUpload = () => {
return useMutation({
mutationFn: api.singleUpload,
});
};
@@ -0,0 +1,12 @@
import axios from "@/config/axios";
import type { SingleUploadResponseType } from "../types/Types";
export const singleUpload = async (file: File) => {
const formData = new FormData();
formData.append("file", file);
const { data } = await axios.post<SingleUploadResponseType>(
"/admin/single-file",
formData,
);
return data;
};
+12
View File
@@ -0,0 +1,12 @@
import type { BaseResponse } from "@/shared/types/Types";
export type SingleUploadType = {
url: string;
file: {
url: string;
key: string;
bucket: string;
};
};
export type SingleUploadResponseType = BaseResponse<SingleUploadType>;