Skip to content

Commit

Permalink
feat: change component name and api route
Browse files Browse the repository at this point in the history
  • Loading branch information
sthefanisilveira committed Sep 29, 2023
1 parent cdf4ee9 commit ca7e29c
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 40 deletions.
5 changes: 2 additions & 3 deletions src/api/appType/whatsapp_cloud/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ export default {
configurePhoneNumber(data) {
return request.$http.post(`${resource}/`, data);
},
getWhatsAppCloudCatalogs(appUuid, params) {
const queryString = qs.stringify(params);
return request.$http.get(`${catalogsResource}/${appUuid}/catalogs/?${queryString}`);
getWhatsAppCloudCatalogs(appUuid) {
return request.$http.get(`${catalogsResource}/${appUuid}/catalogs/`);
},
fetchCatalogData(appUuid, catalogUuid) {
return request.$http.get(`${catalogsResource}/${appUuid}/catalogs/${catalogUuid}/`);
Expand Down
12 changes: 6 additions & 6 deletions src/components/whatsAppCatalogs/Card.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@

<script>
import { mapActions, mapState } from 'vuex';
/* import debounce from 'lodash.debounce';
import { unnnicCallAlert } from '@weni/unnnic-system'; */
import debounce from 'lodash.debounce';
import { unnnicCallAlert } from '@weni/unnnic-system';
export default {
name: 'Card',
Expand Down Expand Up @@ -100,9 +100,9 @@
],
};
},
/* created() {
created() {
this.fetchData();
}, */
},
computed: {
...mapState('WhatsAppCloud', [
'loadingWhatsAppCloudCatalogs',
Expand All @@ -115,7 +115,7 @@
},
methods: {
...mapActions('WhatsAppCloud', ['getWhatsAppCloudCatalogs']),
/* fetchData: debounce(async function () {
fetchData: debounce(async function () {
const { appUuid } = this.$route.params;
await this.getWhatsAppCloudCatalogs({ appUuid });
Expand All @@ -133,7 +133,7 @@
seconds: 8,
});
}
}, 750), */
}, 750),
modalDisableCatalog() {
this.openModal = true;
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<template>
<div class="whatsapp-catalog-table">
<div class="whatsapp-catalog-table__header">
<div class="whatsapp-catalog-table__header__title">
<div class="whatsapp-catalog-list">
<div class="whatsapp-catalog-list__header">
<div class="whatsapp-catalog-list__header__title">
<unnnic-card
class="whatsapp-catalog-table__header__title__text"
class="whatsapp-catalog-list__header__title__text"
type="title"
:title="$t('WhatsApp.catalog.list.title')"
:hasInformationIcon="false"
Expand All @@ -14,7 +14,7 @@
{{ $t('WhatsApp.catalog.list.description') }}
</span>
</div>
<div class="whatsapp-catalog-table__header__button">
<div class="whatsapp-catalog-list__header__button">
<unnnic-button-next type="terciary" size="large">
{{ $t('WhatsApp.catalog.list.advanced_settings') }}
</unnnic-button-next>
Expand All @@ -28,15 +28,15 @@
import Card from '@/components/whatsAppCatalogs/Card';
export default {
name: 'Table',
name: 'List',
components: {
Card,
},
};
</script>

<style lang="scss" scoped>
.whatsapp-catalog-table {
.whatsapp-catalog-list {
display: flex;
flex-direction: column;
flex: 1;
Expand Down
4 changes: 2 additions & 2 deletions src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ const routes = [
component: () => import('@/views/whatsAppCatalogs/Base.vue'),
children: [
{
name: 'WhatsApp Catalogs Table',
name: 'WhatsApp Catalogs List',
path: '',
component: () => import('@/views/whatsAppCatalogs/Table.vue'),
component: () => import('@/views/whatsAppCatalogs/List.vue'),
meta: {
crumb_title: 'WhatsApp.catalog.list.title',
},
Expand Down
4 changes: 2 additions & 2 deletions src/store/appType/channels/whatsapp_cloud/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ export default {
setSelectedPhoneNumber({ commit }, { data }) {
commit('SET_SELECTED_PHONE_NUMBER', data);
},
async getWhatsAppCloudCatalogs({ commit }, { appUuid, params }) {
async getWhatsAppCloudCatalogs({ commit }, { appUuid }) {
commit('GET_WHATSAPP_CATALOGS_REQUEST');
try {
const { data } = await whatsAppCloud.getWhatsAppCloudCatalogs(appUuid, params);
const { data } = await whatsAppCloud.getWhatsAppCloudCatalogs(appUuid);
commit('GET_WHATSAPP_CATALOGS_SUCCESS', data);
} catch (err) {
captureSentryException(err);
Expand Down
2 changes: 1 addition & 1 deletion src/views/whatsAppCatalogs/Base.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
handleCrumbClick(crumb) {
if (crumb.meta === this.$route.name) return;
if (crumb.meta === 'WhatsApp Catalogs Table') {
if (crumb.meta === 'WhatsApp Catalogs List') {
this.$router.go(-1);
} else {
this.$router.push(crumb.path);
Expand Down
19 changes: 19 additions & 0 deletions src/views/whatsAppCatalogs/List.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<template>
<div class="whatsapp-catalogs">
<div v-if="$route.name === 'WhatsApp Catalogs List'">
<List />
</div>
<router-view v-else />
</div>
</template>

<script>
import List from '@/components/whatsAppCatalogs/List';
export default {
name: 'WhatsAppCatalogsList',
components: {
List,
},
};
</script>
19 changes: 0 additions & 19 deletions src/views/whatsAppCatalogs/Table.vue

This file was deleted.

0 comments on commit ca7e29c

Please sign in to comment.