Skip to content

Commit

Permalink
fix(editmessage): put switch translate into computed
Browse files Browse the repository at this point in the history
  • Loading branch information
Jekrimo committed May 16, 2022
1 parent 469c4ef commit 79bcd72
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<!--Alert description-->
<div class="description">
<TypographyText
:text="$t(translateText, translateParameter)" />
:text="setTranslateText" />
</div>
</div>
<InteractablesClose :action="dismiss" />
Expand Down
22 changes: 10 additions & 12 deletions components/views/navigation/toolbar/alerts/alert/Alert.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import Vue, { PropType } from 'vue'
import { mapState } from 'vuex'
import VueI18n from 'vue-i18n'
import { Alert, AlertType } from '~/libraries/ui/Alerts'
import { RootState } from '~/types/store/store'
Expand All @@ -18,24 +19,21 @@ export default Vue.extend({
data() {
return {
hidden: false,
AlertType,
translateText: '',
translateParameter: {},
}
},
computed: {
...mapState({ ui: (state) => (state as RootState).ui }),
},
mounted() {
switch (this.alert?.type) {
case AlertType.DIRECT_MESSAGE: {
this.translateText = 'messaging.user_sent.user'
this.translateParameter = {
user: this.alert.from,
msgType: this.alert.type,
setTranslateText(): VueI18n.TranslateResult | undefined {
switch (this.alert?.type) {
case AlertType.DIRECT_MESSAGE: {
return this.$t('messaging.user_sent.user', {
user: this.alert.from,
msgType: this.alert.type,
})
}
}
}
return this.$t('user_sent_something.user')
},
},
methods: {
dismiss() {
Expand Down

0 comments on commit 79bcd72

Please sign in to comment.