24 lines
580 B
JavaScript
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
|
|
}
|
|
}
|
|
}
|
|
} |