From f969e9ab3d08f0b8cf6b5201094243feff6fc3d0 Mon Sep 17 00:00:00 2001
From: taehoon <th.dev91@gmail.com>
Date: Thu, 24 Oct 2019 22:21:33 -0400
Subject: [PATCH] add fetchStatus action

---
 src/components/status_popover/status_popover.js | 5 +----
 src/modules/statuses.js                         | 4 ++++
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/components/status_popover/status_popover.js b/src/components/status_popover/status_popover.js
index b96ae642..19f16bd9 100644
--- a/src/components/status_popover/status_popover.js
+++ b/src/components/status_popover/status_popover.js
@@ -25,10 +25,7 @@ const StatusPopover = {
   methods: {
     enter () {
       if (!this.status) {
-        this.$store.state.api.backendInteractor.fetchStatus({ id: this.statusId })
-          .then((status) => {
-            this.$store.dispatch('addNewStatuses', { statuses: [status] })
-          })
+        this.$store.dispatch('fetchStatus', this.statusId)
       }
     }
   }
diff --git a/src/modules/statuses.js b/src/modules/statuses.js
index 918065d2..f11ffdcd 100644
--- a/src/modules/statuses.js
+++ b/src/modules/statuses.js
@@ -537,6 +537,10 @@ const statuses = {
     setNotificationsSilence ({ rootState, commit }, { value }) {
       commit('setNotificationsSilence', { value })
     },
+    fetchStatus ({ rootState, dispatch }, id) {
+      rootState.api.backendInteractor.fetchStatus({ id })
+        .then((status) => dispatch('addNewStatuses', { statuses: [status] }))
+    },
     deleteStatus ({ rootState, commit }, status) {
       commit('setDeleted', { status })
       apiService.deleteStatus({ id: status.id, credentials: rootState.users.currentUser.credentials })