diff options
author | Jacob Schatz <jschatz1@gmail.com> | 2017-08-06 21:29:38 +0300 |
---|---|---|
committer | Jacob Schatz <jschatz1@gmail.com> | 2017-08-06 21:29:38 +0300 |
commit | aac0bc09ae6f19b9d9c6de6628ff63d5daa43114 (patch) | |
tree | f4f79842a35814741226269fdbb8c8009957bc91 /app/assets/javascripts | |
parent | a87166d93124ca8286105a8e9a6b7c885e5d1664 (diff) |
Split up the service call.
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r-- | app/assets/javascripts/repo/components/repo_commit_section.vue | 7 | ||||
-rw-r--r-- | app/assets/javascripts/repo/services/repo_service.js | 8 |
2 files changed, 11 insertions, 4 deletions
diff --git a/app/assets/javascripts/repo/components/repo_commit_section.vue b/app/assets/javascripts/repo/components/repo_commit_section.vue index c939c5b6bb9..fa0b9acce58 100644 --- a/app/assets/javascripts/repo/components/repo_commit_section.vue +++ b/app/assets/javascripts/repo/components/repo_commit_section.vue @@ -1,9 +1,9 @@ <script> /* global Flash */ import Store from '../stores/repo_store'; -import Api from '../../api'; import RepoMixin from '../mixins/repo_mixin'; import Helper from '../helpers/repo_helper'; +import Service from '../services/repo_service'; const RepoCommitSection = { data: () => Store, @@ -17,7 +17,7 @@ const RepoCommitSection = { }, cantCommitYet() { - return !commitMessage || submitCommitsLoading; + return !this.commitMessage || this.submitCommitsLoading; }, filePluralize() { @@ -41,9 +41,8 @@ const RepoCommitSection = { actions, }; Store.submitCommitsLoading = true; - Api.commitMultiple(Store.projectId, payload, (data) => { + Service.commitFiles(payload, () => { Store.submitCommitsLoading = false; - Flash(`Your changes have been committed. Commit ${data.short_id} with ${data.stats.additions} additions, ${data.stats.deletions} deletions.`, 'notice'); this.changedFiles = []; this.openedFiles = []; this.commitMessage = ''; diff --git a/app/assets/javascripts/repo/services/repo_service.js b/app/assets/javascripts/repo/services/repo_service.js index 6cc8321deb5..234159ccd9b 100644 --- a/app/assets/javascripts/repo/services/repo_service.js +++ b/app/assets/javascripts/repo/services/repo_service.js @@ -1,5 +1,6 @@ import axios from 'axios'; import Store from '../stores/repo_store'; +import Api from '../../api'; const RepoService = { url: '', @@ -68,6 +69,13 @@ const RepoService = { return urlArray.join('/'); }, + + commitFiles(payload, cb) { + Api.commitMultiple(Store.projectId, payload, (data) => { + Flash(`Your changes have been committed. Commit ${data.short_id} with ${data.stats.additions} additions, ${data.stats.deletions} deletions.`, 'notice'); + cb(); + }); + }, }; export default RepoService; |