Skip to content

Instantly share code, notes, and snippets.

@iErik
Created April 24, 2020 16:47
Show Gist options
  • Save iErik/54986c6e4115d3cafc3f01ffc36deb64 to your computer and use it in GitHub Desktop.
Save iErik/54986c6e4115d3cafc3f01ffc36deb64 to your computer and use it in GitHub Desktop.
export default ({ http }) => ({
getAll: () =>
http
.get('users/notifications')
.then(res => res.data)
.catch(err => console.error('notifications.getAll: ', err)),
paginate: ({ perPage, archived, types }) =>
http
.get(
`users/notifications/?per_page=${perPage}&archived=${+archived}&types=${(
types || []
).join(',')}`
)
.then(res => res.data)
.catch(err => console.error('notifications.paginate: ', err)),
getTypes: () =>
http
.get(`users/notifications/types`)
.then(res => (res.data || {}).data)
.catch(err => console.error('notifications.getTypes: ', err))
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment