diff options
| author | William Pitcock <nenolod@dereferenced.org> | 2018-06-07 01:24:31 +0000 |
|---|---|---|
| committer | William Pitcock <nenolod@dereferenced.org> | 2018-06-07 01:24:31 +0000 |
| commit | 7389f071151d271187b3236a4f56ebfdc018c289 (patch) | |
| tree | 85ff635aec4b68e24f456a93eb3120c9faf12a7a /src/components/follow_requests | |
| parent | fd25f6874193fb9413f14be17f7c6e567a3b8a28 (diff) | |
follow requests: refactor to properly leverage vuex
Diffstat (limited to 'src/components/follow_requests')
| -rw-r--r-- | src/components/follow_requests/follow_requests.js | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/components/follow_requests/follow_requests.js b/src/components/follow_requests/follow_requests.js index 9fe4a57e..11a228aa 100644 --- a/src/components/follow_requests/follow_requests.js +++ b/src/components/follow_requests/follow_requests.js @@ -1,17 +1,22 @@ import UserCard from '../user_card/user_card.vue' const FollowRequests = { - data () { - return { - requests: [] - } - }, components: { UserCard }, created () { - this.$store.state.api.backendInteractor.fetchFollowRequests() - .then((requests) => { this.requests = requests }) + this.updateRequests() + }, + computed: { + requests () { + return this.$store.state.api.followRequests + } + }, + methods: { + updateRequests () { + this.$store.state.api.backendInteractor.fetchFollowRequests() + .then((requests) => { this.$store.commit('setFollowRequests', requests) }) + } } } |
