You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CoreID/app/assets/app/service/Profile.service.js

29 lines
988 B

class ProfileService {
async get_profile(user_id = 'me') {
const results = await axios.get(`/api/v1/profile/${user_id}`)
if ( results && results.data && results.data.data ) return results.data.data
}
async get_notify(user_id = 'me') {
const results = await axios.get(`/api/v1/profile/${user_id}/notify`)
if ( results && results.data && results.data.data ) return results.data.data
}
async update_profile({ user_id, first_name, last_name, email, tagline = undefined }) {
await axios.patch(`/api/v1/profile/${user_id}`, { first_name, last_name, email, tagline })
}
async update_notify({ user_id = 'me', app_key, gateway_url }) {
await axios.patch(`/api/v1/profile/${user_id}/notify`, { app_key, gateway_url })
}
async test_notify({ user_id = 'me' }) {
await axios.post(`/api/v1/profile/${user_id}/notify/test`)
}
}
const profile_service = new ProfileService()
export { profile_service }