riseup-squad21/services/atribuicoesApi.ts
2025-10-20 21:49:35 -03:00

24 lines
713 B
TypeScript

// Caminho: services/atribuicoesApi.ts
import api from './api';
export interface PatientAssignment {
id: any;
patient_id: string;
user_id: string;
role: 'medico' | 'enfermeiro';
[key: string]: any;
}
export const atribuicoesApi = {
list: async (): Promise<PatientAssignment[]> => {
const response = await api.get<PatientAssignment[]>('/rest/v1/patient_assignments');
return response.data;
},
create: async (data: Omit<PatientAssignment, 'id' | 'created_at'>): Promise<PatientAssignment> => {
const response = await api.post<PatientAssignment[]>('/rest/v1/patient_assignments', data, {
headers: { 'Prefer': 'return=representation' }
});
return response.data[0];
},
};