clqms-fe1/src/lib/api/specialties.js

23 lines
650 B
JavaScript

import { get, post, patch, del } from './client.js';
export async function fetchSpecialties(params = {}) {
const query = new URLSearchParams(params).toString();
return get(query ? `/api/medicalspecialty?${query}` : '/api/medicalspecialty');
}
export async function fetchSpecialty(id) {
return get(`/api/medicalspecialty/${id}`);
}
export async function createSpecialty(data) {
return post('/api/medicalspecialty', data);
}
export async function updateSpecialty(data) {
return patch('/api/medicalspecialty', data);
}
export async function deleteSpecialty(id) {
return del('/api/medicalspecialty', { body: JSON.stringify({ id }) });
}