35 lines
952 B
JavaScript
35 lines
952 B
JavaScript
import axiosInstance from '../axiosConfig';
|
|
|
|
|
|
export const getEmployees = async () => {
|
|
const response = await axiosInstance.get('http://localhost:5000/employees');
|
|
return response.data;
|
|
};
|
|
|
|
|
|
export const getEmployeeById = async (id) => {
|
|
const response = await axiosInstance.get(`http://localhost:5000/employees/${id}`);
|
|
return response.data;
|
|
};
|
|
|
|
|
|
export const createEmployee = async (employeeData) => {
|
|
const response = await axiosInstance.post('http://localhost:5000/employees', employeeData, {
|
|
headers: {
|
|
'Content-Type': 'multipart/form-data',
|
|
},
|
|
});
|
|
return response.data;
|
|
};
|
|
|
|
|
|
export const updateEmployee = async (id, updatedData) => {
|
|
const response = await axiosInstance.patch(`http://localhost:5000/employees/${id}`, updatedData);
|
|
return response.data;
|
|
};
|
|
|
|
|
|
export const deleteEmployee = async (id) => {
|
|
await axiosInstance.delete(`http://localhost:5000/employees/${id}`);
|
|
};
|