diff options
Diffstat (limited to 'app/assets/javascripts/related_issues/services')
-rw-r--r-- | app/assets/javascripts/related_issues/services/related_issues_service.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/app/assets/javascripts/related_issues/services/related_issues_service.js b/app/assets/javascripts/related_issues/services/related_issues_service.js new file mode 100644 index 00000000000..3c19f63157e --- /dev/null +++ b/app/assets/javascripts/related_issues/services/related_issues_service.js @@ -0,0 +1,34 @@ +import axios from '~/lib/utils/axios_utils'; +import { linkedIssueTypesMap } from '../constants'; + +class RelatedIssuesService { + constructor(endpoint) { + this.endpoint = endpoint; + } + + fetchRelatedIssues() { + return axios.get(this.endpoint); + } + + addRelatedIssues(newIssueReferences, linkType = linkedIssueTypesMap.RELATES_TO) { + return axios.post(this.endpoint, { + issuable_references: newIssueReferences, + link_type: linkType, + }); + } + + static saveOrder({ endpoint, move_before_id, move_after_id }) { + return axios.put(endpoint, { + epic: { + move_before_id, + move_after_id, + }, + }); + } + + static remove(endpoint) { + return axios.delete(endpoint); + } +} + +export default RelatedIssuesService; |