MT#64124 Refresh Call Forwarding component on page change

- Add resetCallForwardingState action to reset the state when the page changes

Change-Id: I95a2cd4a7c7bce492969a42b81d37bd04524a8ab
mr14.1
nidrissi-zouggari 6 months ago
parent 3f9ebb605d
commit ee99017a28

@ -134,6 +134,7 @@ export default {
}
},
async mounted () {
await this.resetCallForwardingState()
await this.loadAnnouncements()
await this.loadMappingsFull()
},
@ -141,7 +142,8 @@ export default {
...mapActions('callForwarding', [
'loadMappingsFull',
'createMapping',
'loadAnnouncements'
'loadAnnouncements',
'resetCallForwardingState'
])
}
}

@ -780,3 +780,6 @@ export async function updateAnnouncement ({ dispatch, commit, state }, payload)
destinationSets: destinationSets.items
})
}
export function resetCallForwardingState ({ commit }) {
commit('resetState')
}

@ -4,12 +4,15 @@ export function groups (state) {
const types = ['cfu', 'cft', 'cfna', 'cfb']
const mappings = []
types.forEach((type) => {
state.mappings[type].forEach((mapping, index) => {
const clonedMapping = _.clone(mapping)
clonedMapping.type = type
clonedMapping.index = index
mappings.push(clonedMapping)
})
const typeMapping = state.mappings?.[type]
if (Array.isArray(typeMapping)) {
typeMapping.forEach((mapping, index) => {
const clonedMapping = _.clone(mapping)
clonedMapping.type = type
clonedMapping.index = index
mappings.push(clonedMapping)
})
}
})
return mappings
}

@ -43,3 +43,21 @@ export function popupShow (state, popupId) {
export function setAnnouncements (state, announcements) {
state.announcements = announcements
}
export function resetState (state) {
state.mappings = {
cfu: [],
cft: [],
cfna: [],
cfb: [],
cft_ringtimeout: null
}
state.bNumberSetMap = {}
state.destinationSetMap = {}
state.sourceSetMap = {}
state.timeSetMap = {}
state.bNumberSets = null
state.destinationSets = null
state.sourceSets = null
state.timeSets = null
state.announcements = []
}

Loading…
Cancel
Save