diff options
author | Jacob Schatz <jschatz1@gmail.com> | 2017-10-13 00:31:40 +0300 |
---|---|---|
committer | Jacob Schatz <jschatz1@gmail.com> | 2017-10-13 00:31:40 +0300 |
commit | 18a7805f383566534c915a426392738090d2426f (patch) | |
tree | 8cd6e401c915368d51f21bdc76417c1de02d80aa | |
parent | 1fab12cd1e4b026b278ba3231c1cd98d3cf473fd (diff) |
Remove knownledge of service from store.
-rw-r--r-- | app/assets/javascripts/repo/components/repo_commit_section.vue | 21 | ||||
-rw-r--r-- | app/assets/javascripts/repo/stores/repo_store.js | 15 |
2 files changed, 17 insertions, 19 deletions
diff --git a/app/assets/javascripts/repo/components/repo_commit_section.vue b/app/assets/javascripts/repo/components/repo_commit_section.vue index bd8d29989a7..5f84217d23a 100644 --- a/app/assets/javascripts/repo/components/repo_commit_section.vue +++ b/app/assets/javascripts/repo/components/repo_commit_section.vue @@ -73,16 +73,17 @@ export default { if (skipBranchCheck) { this.makeCommit(newBranch); } else { - Store.setBranchHash() - .then(() => { - if (Store.branchChanged) { - Store.showBranchChangeDialog = true; - this.$emit('showBranchChangeDialog:enabled'); - return; - } - this.makeCommit(newBranch); - }) - .catch(this.commitError); + Service.branchSingle() + .then((data) => { + Store.setBranchHash(data) + if (Store.branchChanged) { + Store.showBranchChangeDialog = true; + this.$emit('showBranchChangeDialog:enabled'); + return; + } + this.makeCommit(newBranch); + }) + .catch(this.commitError); } }, diff --git a/app/assets/javascripts/repo/stores/repo_store.js b/app/assets/javascripts/repo/stores/repo_store.js index 0ef8eb53c3b..aec18cc2f8a 100644 --- a/app/assets/javascripts/repo/stores/repo_store.js +++ b/app/assets/javascripts/repo/stores/repo_store.js @@ -55,15 +55,12 @@ const RepoStore = { }); }, - setBranchHash() { - return Service.branchSingle() - .then((data) => { - if (RepoStore.currentHash !== '' && data.commit.id !== RepoStore.currentHash) { - RepoStore.branchChanged = true; - } - RepoStore.currentHash = data.commit.id; - RepoStore.currentShortHash = data.commit.short_id; - }); + setBranchHash(data) { + if (RepoStore.currentHash !== '' && data.commit.id !== RepoStore.currentHash) { + RepoStore.branchChanged = true; + } + RepoStore.currentHash = data.commit.id; + RepoStore.currentShortHash = data.commit.short_id; }, hasBranchChanged() { |