Commit aac0bc09 authored by Jacob Schatz's avatar Jacob Schatz

Split up the service call.

parent 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%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment