refactor: move fetch to a separate method

This commit is contained in:
Shivam Mishra
2023-07-10 15:04:08 +05:30
parent b9a54f8524
commit 3d3fd2f2bf
+6 -3
View File
@@ -3,9 +3,7 @@ import { OPEN_AI_EVENTS } from '../helper/AnalyticsHelper/events';
export default {
mounted() {
if (!this.appIntegrations.length) {
this.$store.dispatch('integrations/get');
}
this.fetchIntegrationsIfRequired();
},
computed: {
...mapGetters({ appIntegrations: 'integrations/getAppIntegrations' }),
@@ -21,6 +19,11 @@ export default {
},
},
methods: {
async fetchIntegrationsIfRequired() {
if (!this.appIntegrations.length) {
await this.$store.dispatch('integrations/get');
}
},
async recordAnalytics(type, payload) {
const event = OPEN_AI_EVENTS[type.toUpperCase()];
if (event) {