Gitlab@Informatics

Skip to content
Snippets Groups Projects
Commit 5c74747c authored by Pattaradanai Srisarakorn's avatar Pattaradanai Srisarakorn
Browse files

add employee service functions for CRUD operations

parent 98cdb81a
No related branches found
No related tags found
No related merge requests found
import http from './http'
import type { Employee } from '@/types/Employee'
export async function listEmployees(): Promise<Employee[]> {
const { data } = await http.get('/employees')
return data
}
export async function getEmployee(id: number): Promise<Employee> {
const { data } = await http.get(`/employees/${id}`)
return data
}
export async function createEmployee(payload: Partial<Employee>): Promise<Employee> {
const { data } = await http.post('/employees', payload)
return data
}
export async function updateEmployee(id: number, payload: Partial<Employee>): Promise<Employee> {
const { data } = await http.put(`/employees/${id}`, payload)
return data
}
export async function deleteEmployee(id: number): Promise<void> {
await http.delete(`/employees/${id}`)
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment