Skip to content

Commit

Permalink
fix:errors in header and API[WTEL-4418]
Browse files Browse the repository at this point in the history
  • Loading branch information
Lera24 committed Apr 23, 2024
1 parent 9f52564 commit 68b3549
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/modules/contacts/modules/timeline/api/TimelineAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const timeline = new TimelineApiFactory(configuration, '', instance);

const listHandler = (items) => {
let copy = deepCopy(items);
if(copy) {
if(copy.length) {
return copy.map(day => ({
...day,
items: day.items.map(item => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
</template>
<script setup>
import { useTableFilters } from '@webitel/ui-sdk/src/modules/Filters/composables/useTableFilters.js';
import isEmpty from '@webitel/ui-sdk/src/scripts/isEmpty';
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { useStore } from 'vuex';
Expand All @@ -40,15 +41,16 @@ const { filtersNamespace } = useTableFilters(props.namespace);
const isDisplayHeader = computed(() => props.list.length || (!props.list.length));
const taskCounters = computed(() => {
return props.list.reduce((acc, { callsCount = 0, chatsCount = 0 }) => {
return {
[WebitelContactsTimelineEventType.Call]: acc[WebitelContactsTimelineEventType.Call] + +callsCount,
[WebitelContactsTimelineEventType.Chat]: acc[WebitelContactsTimelineEventType.Chat] + +chatsCount,
};
}, {
[WebitelContactsTimelineEventType.Call]: 0,
[WebitelContactsTimelineEventType.Chat]: 0,
});
const arr = !isEmpty(props.list) ? props.list : [];
return arr.reduce((acc, { callsCount = 0, chatsCount = 0 }) => {
return {
[WebitelContactsTimelineEventType.Call]: acc[WebitelContactsTimelineEventType.Call] + +callsCount,
[WebitelContactsTimelineEventType.Chat]: acc[WebitelContactsTimelineEventType.Chat] + +chatsCount,
};
}, {
[WebitelContactsTimelineEventType.Call]: 0,
[WebitelContactsTimelineEventType.Chat]: 0,
})
});
const dateFrom = computed(() => props.list[props.list.length - 1]?.dayTimestamp);
Expand Down
7 changes: 2 additions & 5 deletions src/modules/contacts/modules/timeline/store/timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,12 @@ const api = new ApiStoreModule()
.getModule();

const timeline = new BaseStoreModule()
.getModule( {
.setChildModules({ api, filters })
.getModule( {
state,
getters,
actions,
mutations,
modules: {
api,
filters,
},
});

export default timeline;

0 comments on commit 68b3549

Please sign in to comment.