import client by excel
This commit is contained in:
@@ -2,6 +2,7 @@ import axios from "@/config/axios";
|
||||
import type {
|
||||
GetCustomersResponse,
|
||||
GetUsersParams,
|
||||
ImportUsersResponse,
|
||||
} from "@/pages/customers/types/Types";
|
||||
|
||||
export const getUsers = async (params?: GetUsersParams) => {
|
||||
@@ -10,3 +11,20 @@ export const getUsers = async (params?: GetUsersParams) => {
|
||||
});
|
||||
return data;
|
||||
};
|
||||
|
||||
export const importUsersFromExcel = async (file: File) => {
|
||||
const formData = new FormData();
|
||||
formData.append("file", file);
|
||||
|
||||
const { data } = await axios.post<ImportUsersResponse>(
|
||||
`/admin/users/import`,
|
||||
formData,
|
||||
{
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data",
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
return data.data;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user