Created
July 25, 2017 17:01
-
-
Save gabovanlugo/977a4dcce56fc40777746bb08f240e76 to your computer and use it in GitHub Desktop.
Factory with annotation
This file contains hidden or 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
const adjustmentService = function ( | |
// TODO Create Adjustments sercives | |
AdjustmentsQuery) { | |
'ngInject'; | |
// TODO Create Adjustments sercives | |
const service = AdjustmentsQuery; | |
const pageSize = 20; | |
const data = () => { | |
return service.getList(1, pageSize, 'modificationDate', 'desc', 'mine') | |
.then(response => { | |
return { | |
total: response.data.totalCount | |
}; | |
}); | |
}; | |
const get = (options) => { | |
return service.getList( | |
options.page.index, | |
pageSize, | |
options.order.column || 'modificationDate', | |
options.order.direction || 'desc', | |
'mine') | |
.then(response => { | |
return { | |
page: response.data.pageNumber, | |
data: response.data.data | |
}; | |
}); | |
}; | |
return { | |
data, | |
get | |
}; | |
}; | |
export default adjustmentService; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment