accept status id instead of status obj as statusoid prop

This commit is contained in:
taehoon 2019-08-30 11:47:15 -04:00
parent e75ac9ddbc
commit d7c68d408f
3 changed files with 11 additions and 16 deletions

View file

@ -5,12 +5,8 @@ const conversationPage = {
Conversation Conversation
}, },
computed: { computed: {
statusoid () { statusId () {
const id = this.$route.params.id return this.$route.params.id
const statuses = this.$store.state.statuses.allStatusesObject
const status = statuses[id]
return status
} }
} }
} }

View file

@ -2,7 +2,7 @@
<conversation <conversation
:collapsable="false" :collapsable="false"
is-page="true" is-page="true"
:statusoid="statusoid" :statusoid="statusId"
/> />
</template> </template>

View file

@ -51,20 +51,20 @@ const conversation = {
}, },
computed: { computed: {
status () { status () {
return this.statusoid return this.$store.state.statuses.allStatusesObject[this.statusoid]
}, },
statusId () { statusId () {
if (this.statusoid.retweeted_status) { if (this.status.retweeted_status) {
return this.statusoid.retweeted_status.id return this.status.retweeted_status.id
} else { } else {
return this.statusoid.id return this.status.id
} }
}, },
conversationId () { conversationId () {
if (this.statusoid.retweeted_status) { if (this.status.retweeted_status) {
return this.statusoid.retweeted_status.statusnet_conversation_id return this.status.retweeted_status.statusnet_conversation_id
} else { } else {
return this.statusoid.statusnet_conversation_id return this.status.statusnet_conversation_id
} }
}, },
conversation () { conversation () {
@ -127,8 +127,7 @@ const conversation = {
}) })
.then(() => this.setHighlight(this.statusId)) .then(() => this.setHighlight(this.statusId))
} else { } else {
const id = this.$route.params.id this.$store.state.api.backendInteractor.fetchStatus({ id: this.statusoid })
this.$store.state.api.backendInteractor.fetchStatus({ id })
.then((status) => this.$store.dispatch('addNewStatuses', { statuses: [status] })) .then((status) => this.$store.dispatch('addNewStatuses', { statuses: [status] }))
.then(() => this.fetchConversation()) .then(() => this.fetchConversation())
} }