You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
122 lines
3.8 KiB
122 lines
3.8 KiB
|
|
<template>
|
|
<csc-page class="csc-simple-page">
|
|
<csc-voicebox-settings
|
|
v-if="isSettingsLoaded"
|
|
:settings="voiceboxSettings"
|
|
:deleteRequesting="isDeleteRequesting"
|
|
:attachRequesting="isAttachRequesting"
|
|
:pinRequesting="isPinRequesting"
|
|
:emailRequesting="isEmailRequesting"
|
|
:deleteLabel="deleteLabel"
|
|
:attachLabel="attachLabel"
|
|
/>
|
|
</csc-page>
|
|
</template>
|
|
|
|
<script>
|
|
import { mapGetters } from 'vuex'
|
|
import CscPage from '../../CscPage'
|
|
import CscVoiceboxSettings from './CscVoiceboxSettings'
|
|
import {
|
|
startLoading,
|
|
stopLoading,
|
|
showToast,
|
|
showGlobalError
|
|
} from '../../../helpers/ui'
|
|
export default {
|
|
data () {
|
|
return {
|
|
}
|
|
},
|
|
components: {
|
|
CscPage,
|
|
CscVoiceboxSettings
|
|
},
|
|
created() {
|
|
this.$store.dispatch('voicebox/getVoiceboxSettings');
|
|
},
|
|
computed: {
|
|
...mapGetters('voicebox', [
|
|
'voiceboxSettings',
|
|
'deleteLabel',
|
|
'attachLabel',
|
|
'isDeleteRequesting',
|
|
'isAttachRequesting',
|
|
'isPinRequesting',
|
|
'isEmailRequesting',
|
|
'isSettingsLoaded',
|
|
'loadingState',
|
|
'loadingError',
|
|
'toggleDeleteState',
|
|
'toggleDeleteError',
|
|
'toggleAttachState',
|
|
'toggleAttachError',
|
|
'updatePinState',
|
|
'updatePinError',
|
|
'updateEmailState',
|
|
'updateEmailError',
|
|
])
|
|
},
|
|
watch: {
|
|
loadingState(state) {
|
|
if (state === 'requesting') {
|
|
startLoading();
|
|
}
|
|
else if (state === 'succeeded') {
|
|
stopLoading();
|
|
}
|
|
else if (state === 'failed') {
|
|
stopLoading();
|
|
showGlobalError(this.loadingError);
|
|
}
|
|
},
|
|
toggleDeleteState(state) {
|
|
if (state === 'requesting') {
|
|
startLoading();
|
|
}
|
|
else if (state === 'succeeded') {
|
|
stopLoading();
|
|
showToast(this.$t('voicebox.toggleDeleteSuccessMessage'));
|
|
}
|
|
else if (state === 'failed') {
|
|
stopLoading();
|
|
showGlobalError(this.toggleDeleteError);
|
|
}
|
|
},
|
|
toggleAttachState(state) {
|
|
if (state === 'requesting') {
|
|
startLoading();
|
|
}
|
|
else if (state === 'succeeded') {
|
|
stopLoading();
|
|
showToast(this.$t('voicebox.toggleAttachSuccessMessage'));
|
|
}
|
|
else if (state === 'failed') {
|
|
stopLoading();
|
|
showGlobalError(this.toggleAttachError);
|
|
}
|
|
},
|
|
updatePinState(state) {
|
|
if (state === 'succeeded') {
|
|
showToast(this.$t('voicebox.updatePinSuccessMessage'));
|
|
}
|
|
else if (state === 'failed') {
|
|
showGlobalError(this.updatePinError);
|
|
}
|
|
},
|
|
updateEmailState(state) {
|
|
if (state === 'succeeded') {
|
|
showToast(this.$t('voicebox.updateEmailSuccessMessage'));
|
|
}
|
|
else if (state === 'failed') {
|
|
showGlobalError(this.updateEmailError);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="stylus" rel="stylesheet/stylus">
|
|
</style>
|