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

23 lines
616 B
TypeScript

// Caminho: services/perfisApi.ts
import api from './api';
export interface Profile {
id: any;
full_name?: string;
avatar_url?: string;
[key: string]: any;
}
export const perfisApi = {
list: async (): Promise<Profile[]> => {
const response = await api.get<Profile[]>('/rest/v1/profiles?select=*');
return response.data;
},
update: async (userId: string, data: Partial<Profile>): Promise<Profile> => {
const response = await api.patch<Profile[]>(`/rest/v1/profiles?id=eq.${userId}`, data, {
headers: { 'Prefer': 'return=representation' }
});
return response.data[0];
},
};