monolito_djanco_poonto/src/services/useprofileservice.js
Thaís Ferreira cb4a5ab5ab versão 14h21
2025-02-06 14:21:55 -03:00

24 lines
580 B
JavaScript

import api from './api'
export default function useProfileService() {
return {
async getProfile() {
try {
const response = await api.get('/profile')
return response.data
} catch (error) {
console.error('Failed to fetch profile:', error)
throw error
}
},
async updateProfile(profileData) {
try {
const response = await api.put('/profile', profileData)
return response.data
} catch (error) {
console.error('Failed to update profile:', error)
throw error
}
}
}
}