提交 aac0bc09 编写于 作者: J Jacob Schatz

Split up the service call.

上级 a87166d9
<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 = '';
......
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;
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册