Commit aac0bc09 authored by Jacob Schatz's avatar Jacob Schatz

Split up the service call.

parent a87166d9
<script> <script>
/* global Flash */ /* global Flash */
import Store from '../stores/repo_store'; import Store from '../stores/repo_store';
import Api from '../../api';
import RepoMixin from '../mixins/repo_mixin'; import RepoMixin from '../mixins/repo_mixin';
import Helper from '../helpers/repo_helper'; import Helper from '../helpers/repo_helper';
import Service from '../services/repo_service';
const RepoCommitSection = { const RepoCommitSection = {
data: () => Store, data: () => Store,
...@@ -17,7 +17,7 @@ const RepoCommitSection = { ...@@ -17,7 +17,7 @@ const RepoCommitSection = {
}, },
cantCommitYet() { cantCommitYet() {
return !commitMessage || submitCommitsLoading; return !this.commitMessage || this.submitCommitsLoading;
}, },
filePluralize() { filePluralize() {
...@@ -41,9 +41,8 @@ const RepoCommitSection = { ...@@ -41,9 +41,8 @@ const RepoCommitSection = {
actions, actions,
}; };
Store.submitCommitsLoading = true; Store.submitCommitsLoading = true;
Api.commitMultiple(Store.projectId, payload, (data) => { Service.commitFiles(payload, () => {
Store.submitCommitsLoading = false; 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.changedFiles = [];
this.openedFiles = []; this.openedFiles = [];
this.commitMessage = ''; this.commitMessage = '';
......
import axios from 'axios'; import axios from 'axios';
import Store from '../stores/repo_store'; import Store from '../stores/repo_store';
import Api from '../../api';
const RepoService = { const RepoService = {
url: '', url: '',
...@@ -68,6 +69,13 @@ const RepoService = { ...@@ -68,6 +69,13 @@ const RepoService = {
return urlArray.join('/'); 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; export default RepoService;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment