From 479575cff9b5b681a74cab91b9a08a7ca47c288c Mon Sep 17 00:00:00 2001
From: AkiraFukushima
Date: Mon, 26 Mar 2018 20:04:29 +0900
Subject: [PATCH] Refactor changeModal of NewTootModal
---
src/renderer/components/TimelineSpace/NewTootModal.vue | 3 ++-
src/renderer/store/TimelineSpace/NewTootModal.js | 5 +----
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/renderer/components/TimelineSpace/NewTootModal.vue b/src/renderer/components/TimelineSpace/NewTootModal.vue
index f4faacbe..0801224f 100644
--- a/src/renderer/components/TimelineSpace/NewTootModal.vue
+++ b/src/renderer/components/TimelineSpace/NewTootModal.vue
@@ -61,7 +61,7 @@ export default {
},
methods: {
close () {
- this.$store.commit('TimelineSpace/NewTootModal/changeModal', false)
+ this.$store.dispatch('TimelineSpace/NewTootModal/changeModal', false)
},
keydown (e) {
if (e.keyCode === 17 || e.keyCode === 93) {
@@ -97,6 +97,7 @@ export default {
}
this.$store.dispatch('TimelineSpace/NewTootModal/postToot', form)
.then(() => {
+ this.close()
this.$message({
message: 'Toot',
type: 'success'
diff --git a/src/renderer/store/TimelineSpace/NewTootModal.js b/src/renderer/store/TimelineSpace/NewTootModal.js
index 5b6c6c1e..b1a1c89f 100644
--- a/src/renderer/store/TimelineSpace/NewTootModal.js
+++ b/src/renderer/store/TimelineSpace/NewTootModal.js
@@ -32,9 +32,6 @@ const NewTootModal = {
)
client.post('/statuses', form, (err, data, res) => {
if (err) return reject(err)
- commit('changeModal', false)
- commit('setReplyTo', null)
- commit('updateStatus', '')
resolve(res)
})
})
@@ -45,11 +42,11 @@ const NewTootModal = {
commit('changeModal', true)
},
changeModal ({ commit }, value) {
- commit('changeModal', value)
if (!value) {
commit('updateStatus', '')
commit('setReplyTo', null)
}
+ commit('changeModal', value)
}
}
}