forked from RiseUP/riseup-squad21
23 lines
616 B
TypeScript
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];
|
|
},
|
|
}; |