refactor: Rewrite the composable to a helper method
This commit is contained in:
@@ -3,7 +3,7 @@ import WidgetHead from './WidgetHead.vue';
|
||||
import WidgetBody from './WidgetBody.vue';
|
||||
import WidgetFooter from './WidgetFooter.vue';
|
||||
import InputRadioGroup from 'dashboard/routes/dashboard/settings/inbox/components/InputRadioGroup.vue';
|
||||
import { useGlobalConfig } from 'shared/composables/useGlobalConfig';
|
||||
import { useInstallationName } from 'shared/helpers/installationHelper';
|
||||
import { mapGetters } from 'vuex';
|
||||
|
||||
export default {
|
||||
@@ -56,12 +56,6 @@ export default {
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
setup() {
|
||||
const { useInstallationName } = useGlobalConfig();
|
||||
return {
|
||||
useInstallationName,
|
||||
};
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
widgetScreens: [
|
||||
@@ -149,6 +143,7 @@ export default {
|
||||
this.isWidgetVisible = !this.isWidgetVisible;
|
||||
this.isDefaultScreen = true;
|
||||
},
|
||||
useInstallationName,
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import { useGlobalConfig } from 'shared/composables/useGlobalConfig';
|
||||
import { useInstallationName } from 'shared/helpers/installationHelper';
|
||||
import SettingsHeader from 'dashboard/routes/dashboard/settings/SettingsHeader.vue';
|
||||
export default {
|
||||
components: {
|
||||
SettingsHeader,
|
||||
},
|
||||
setup() {
|
||||
const { useInstallationName } = useGlobalConfig();
|
||||
return {
|
||||
useInstallationName,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
globalConfig: 'globalConfig/get',
|
||||
@@ -43,6 +37,9 @@ export default {
|
||||
return '';
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
useInstallationName,
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -3,19 +3,13 @@ import ChannelItem from 'dashboard/components/widgets/ChannelItem.vue';
|
||||
import router from '../../../index';
|
||||
import PageHeader from '../SettingsSubPageHeader.vue';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { useGlobalConfig } from 'shared/composables/useGlobalConfig';
|
||||
import { useInstallationName } from 'shared/helpers/installationHelper';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
ChannelItem,
|
||||
PageHeader,
|
||||
},
|
||||
setup() {
|
||||
const { useInstallationName } = useGlobalConfig();
|
||||
return {
|
||||
useInstallationName,
|
||||
};
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
enabledFeatures: {},
|
||||
@@ -61,6 +55,7 @@ export default {
|
||||
};
|
||||
router.push({ name: 'settings_inboxes_page_channel', params });
|
||||
},
|
||||
useInstallationName,
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import { useGlobalConfig } from 'shared/composables/useGlobalConfig';
|
||||
import { useInstallationName } from 'shared/helpers/installationHelper';
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
const { useInstallationName } = useGlobalConfig();
|
||||
return {
|
||||
useInstallationName,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
globalConfig: 'globalConfig/get',
|
||||
@@ -23,6 +17,9 @@ export default {
|
||||
}));
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
useInstallationName,
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useAlert } from 'dashboard/composables';
|
||||
import { useAdmin } from 'dashboard/composables/useAdmin';
|
||||
import { useAccount } from 'dashboard/composables/useAccount';
|
||||
import Settings from './Settings.vue';
|
||||
import { useGlobalConfig } from 'shared/composables/useGlobalConfig';
|
||||
import { useInstallationName } from 'shared/helpers/installationHelper';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -13,11 +13,9 @@ export default {
|
||||
setup() {
|
||||
const { isAdmin } = useAdmin();
|
||||
const { accountScopedUrl } = useAccount();
|
||||
const { useInstallationName } = useGlobalConfig();
|
||||
return {
|
||||
isAdmin,
|
||||
accountScopedUrl,
|
||||
useInstallationName,
|
||||
};
|
||||
},
|
||||
data() {
|
||||
@@ -56,6 +54,7 @@ export default {
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
useInstallationName,
|
||||
twilioChannelName(item) {
|
||||
const { medium = '' } = item;
|
||||
if (medium === 'whatsapp') return 'WhatsApp';
|
||||
|
||||
@@ -10,7 +10,7 @@ import { mapGetters } from 'vuex';
|
||||
import ChannelApi from '../../../../../api/channels';
|
||||
import PageHeader from '../../SettingsSubPageHeader.vue';
|
||||
import router from '../../../../index';
|
||||
import { useGlobalConfig } from 'shared/composables/useGlobalConfig';
|
||||
import { useInstallationName } from 'shared/helpers/installationHelper';
|
||||
|
||||
import { loadScript } from 'dashboard/helper/DOMHelpers';
|
||||
import * as Sentry from '@sentry/browser';
|
||||
@@ -21,10 +21,8 @@ export default {
|
||||
PageHeader,
|
||||
},
|
||||
setup() {
|
||||
const { useInstallationName } = useGlobalConfig();
|
||||
const { accountId } = useAccount();
|
||||
return {
|
||||
useInstallationName,
|
||||
accountId,
|
||||
v$: useVuelidate(),
|
||||
};
|
||||
@@ -75,6 +73,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
useInstallationName,
|
||||
async startLogin() {
|
||||
this.hasLoginStarted = true;
|
||||
try {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { mapGetters } from 'vuex';
|
||||
import { frontendURL } from '../../../../helper/URLHelper';
|
||||
import { useAlert } from 'dashboard/composables';
|
||||
import { useGlobalConfig } from 'shared/composables/useGlobalConfig';
|
||||
import { useInstallationName } from 'shared/helpers/installationHelper';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
@@ -17,12 +17,6 @@ export default {
|
||||
actionButtonText: { type: String, default: '' },
|
||||
deleteConfirmationText: { type: Object, default: () => ({}) },
|
||||
},
|
||||
setup() {
|
||||
const { useInstallationName } = useGlobalConfig();
|
||||
return {
|
||||
useInstallationName,
|
||||
};
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showDeleteConfirmationPopup: false,
|
||||
@@ -35,6 +29,7 @@ export default {
|
||||
}),
|
||||
},
|
||||
methods: {
|
||||
useInstallationName,
|
||||
frontendURL,
|
||||
openDeletePopup() {
|
||||
this.showDeleteConfirmationPopup = true;
|
||||
|
||||
@@ -3,7 +3,7 @@ import { computed } from 'vue';
|
||||
import { useStoreGetters } from 'dashboard/composables/store';
|
||||
import { useI18n } from 'dashboard/composables/useI18n';
|
||||
import { frontendURL } from 'dashboard/helper/URLHelper';
|
||||
import { useGlobalConfig } from 'shared/composables/useGlobalConfig';
|
||||
import { useInstallationName } from 'shared/helpers/installationHelper';
|
||||
|
||||
const props = defineProps({
|
||||
id: {
|
||||
@@ -24,7 +24,6 @@ const props = defineProps({
|
||||
},
|
||||
});
|
||||
|
||||
const { useInstallationName } = useGlobalConfig();
|
||||
const getters = useStoreGetters();
|
||||
const accountId = getters.getCurrentAccountId;
|
||||
const globalConfig = getters['globalConfig/get'];
|
||||
|
||||
+2
-7
@@ -1,7 +1,7 @@
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import { useAlert } from 'dashboard/composables';
|
||||
import { useGlobalConfig } from 'shared/composables/useGlobalConfig';
|
||||
import { useInstallationName } from 'shared/helpers/installationHelper';
|
||||
import messageFormatterMixin from 'shared/mixins/messageFormatterMixin';
|
||||
|
||||
export default {
|
||||
@@ -12,12 +12,6 @@ export default {
|
||||
default: true,
|
||||
},
|
||||
},
|
||||
setup() {
|
||||
const { useInstallationName } = useGlobalConfig();
|
||||
return {
|
||||
useInstallationName,
|
||||
};
|
||||
},
|
||||
data() {
|
||||
return { selectedChannelId: '', availableChannels: [] };
|
||||
},
|
||||
@@ -33,6 +27,7 @@ export default {
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
useInstallationName,
|
||||
async fetchChannels() {
|
||||
try {
|
||||
this.availableChannels = await this.$store.dispatch(
|
||||
|
||||
@@ -3,7 +3,7 @@ import { mapGetters } from 'vuex';
|
||||
import { useAlert } from 'dashboard/composables';
|
||||
import NewWebhook from './NewWebHook.vue';
|
||||
import EditWebhook from './EditWebHook.vue';
|
||||
import { useGlobalConfig } from 'shared/composables/useGlobalConfig';
|
||||
import { useInstallationName } from 'shared/helpers/installationHelper';
|
||||
import WebhookRow from './WebhookRow.vue';
|
||||
|
||||
export default {
|
||||
@@ -12,12 +12,6 @@ export default {
|
||||
EditWebhook,
|
||||
WebhookRow,
|
||||
},
|
||||
setup() {
|
||||
const { useInstallationName } = useGlobalConfig();
|
||||
return {
|
||||
useInstallationName,
|
||||
};
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: {},
|
||||
@@ -38,6 +32,7 @@ export default {
|
||||
this.$store.dispatch('webhooks/get');
|
||||
},
|
||||
methods: {
|
||||
useInstallationName,
|
||||
openAddPopup() {
|
||||
this.showAddPopup = true;
|
||||
},
|
||||
|
||||
+2
-7
@@ -1,6 +1,6 @@
|
||||
<script>
|
||||
import { useAlert } from 'dashboard/composables';
|
||||
import { useGlobalConfig } from 'shared/composables/useGlobalConfig';
|
||||
import { useInstallationName } from 'shared/helpers/installationHelper';
|
||||
import { mapGetters } from 'vuex';
|
||||
import WebhookForm from './WebhookForm.vue';
|
||||
|
||||
@@ -12,12 +12,6 @@ export default {
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
setup() {
|
||||
const { useInstallationName } = useGlobalConfig();
|
||||
return {
|
||||
useInstallationName,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
globalConfig: 'globalConfig/get',
|
||||
@@ -25,6 +19,7 @@ export default {
|
||||
}),
|
||||
},
|
||||
methods: {
|
||||
useInstallationName,
|
||||
async onSubmit(webhook) {
|
||||
try {
|
||||
await this.$store.dispatch('webhooks/create', { webhook });
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useAlert } from 'dashboard/composables';
|
||||
import { useUISettings } from 'dashboard/composables/useUISettings';
|
||||
import { clearCookiesOnLogout } from 'dashboard/store/utils/api.js';
|
||||
import { copyTextToClipboard } from 'shared/helpers/clipboard';
|
||||
import { useGlobalConfig } from 'shared/composables/useGlobalConfig';
|
||||
import { useInstallationName } from 'shared/helpers/installationHelper';
|
||||
import UserProfilePicture from './UserProfilePicture.vue';
|
||||
import UserBasicDetails from './UserBasicDetails.vue';
|
||||
import MessageSignature from './MessageSignature.vue';
|
||||
@@ -28,7 +28,6 @@ export default {
|
||||
AccessToken,
|
||||
},
|
||||
setup() {
|
||||
const { useInstallationName } = useGlobalConfig();
|
||||
const { uiSettings, updateUISettings, isEditorHotKeyEnabled } =
|
||||
useUISettings();
|
||||
|
||||
@@ -36,7 +35,6 @@ export default {
|
||||
uiSettings,
|
||||
updateUISettings,
|
||||
isEditorHotKeyEnabled,
|
||||
useInstallationName,
|
||||
};
|
||||
},
|
||||
data() {
|
||||
@@ -87,6 +85,7 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
useInstallationName,
|
||||
initializeUser() {
|
||||
this.name = this.currentUser.name;
|
||||
this.email = this.currentUser.email;
|
||||
|
||||
Reference in New Issue
Block a user