Created
April 24, 2020 16:47
-
-
Save iErik/54986c6e4115d3cafc3f01ffc36deb64 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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