|
|
@ -3,7 +3,8 @@
|
|
|
|
import { i18n } from '../i18n';
|
|
|
|
import { i18n } from '../i18n';
|
|
|
|
import { RequestState } from './common'
|
|
|
|
import { RequestState } from './common'
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
getSpeedDials
|
|
|
|
getSpeedDials,
|
|
|
|
|
|
|
|
unassignSpeedDialSlot
|
|
|
|
} from '../api/speed-dial';
|
|
|
|
} from '../api/speed-dial';
|
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
@ -12,7 +13,10 @@ export default {
|
|
|
|
assignedSlots: [],
|
|
|
|
assignedSlots: [],
|
|
|
|
slotOptions: [],
|
|
|
|
slotOptions: [],
|
|
|
|
speedDialLoadingState: RequestState.initiated,
|
|
|
|
speedDialLoadingState: RequestState.initiated,
|
|
|
|
speedDialError: null
|
|
|
|
speedDialError: null,
|
|
|
|
|
|
|
|
unassignSlotState: RequestState.initiated,
|
|
|
|
|
|
|
|
unassignSlotError: null,
|
|
|
|
|
|
|
|
lastUnassignedSlot: null
|
|
|
|
},
|
|
|
|
},
|
|
|
|
getters: {
|
|
|
|
getters: {
|
|
|
|
reminderLoadingState(state) {
|
|
|
|
reminderLoadingState(state) {
|
|
|
@ -32,6 +36,15 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
speedDialLoadingError(state) {
|
|
|
|
speedDialLoadingError(state) {
|
|
|
|
return state.speedDialLoadingError || i18n.t('speedDial.loadSpeedDialErrorMessage');
|
|
|
|
return state.speedDialLoadingError || i18n.t('speedDial.loadSpeedDialErrorMessage');
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
unassignSlotState(state) {
|
|
|
|
|
|
|
|
return state.unassignSlotState;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
unassignSlotError(state) {
|
|
|
|
|
|
|
|
return state.unassignSlotError || i18n.t('speedDial.unassignSlotErrorMessage');
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
lastUnassignedSlot(state) {
|
|
|
|
|
|
|
|
return state.lastUnassignedSlot;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
mutations: {
|
|
|
|
mutations: {
|
|
|
@ -47,6 +60,19 @@ export default {
|
|
|
|
speedDialFailed(state, error) {
|
|
|
|
speedDialFailed(state, error) {
|
|
|
|
state.speedDialLoadingState = RequestState.failed;
|
|
|
|
state.speedDialLoadingState = RequestState.failed;
|
|
|
|
state.speedDialLoadingError = error;
|
|
|
|
state.speedDialLoadingError = error;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
unassignSlotRequesting(state) {
|
|
|
|
|
|
|
|
state.unassignSlotState = RequestState.requesting;
|
|
|
|
|
|
|
|
state.unassignSlotError = null;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
unassignSlotSucceeded(state, last) {
|
|
|
|
|
|
|
|
state.lastUnassignedSlot = last;
|
|
|
|
|
|
|
|
state.unassignSlotState = RequestState.succeeded;
|
|
|
|
|
|
|
|
state.unassignSlotError = null;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
unassignSlotFailed(state, error) {
|
|
|
|
|
|
|
|
state.unassignSlotState = RequestState.failed;
|
|
|
|
|
|
|
|
state.unassignSlotError = error;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
actions: {
|
|
|
|
actions: {
|
|
|
@ -57,6 +83,19 @@ export default {
|
|
|
|
}).catch((error) => {
|
|
|
|
}).catch((error) => {
|
|
|
|
context.commit('speedDialFailed', error);
|
|
|
|
context.commit('speedDialFailed', error);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
unassignSpeedDialSlot(context, slot) {
|
|
|
|
|
|
|
|
context.commit('unassignSlotRequesting');
|
|
|
|
|
|
|
|
unassignSpeedDialSlot({
|
|
|
|
|
|
|
|
slots: context.state.assignedSlots,
|
|
|
|
|
|
|
|
slot: slot,
|
|
|
|
|
|
|
|
id: context.getters.subscriberId
|
|
|
|
|
|
|
|
}).then(() => {
|
|
|
|
|
|
|
|
context.commit('unassignSlotSucceeded', slot.slot);
|
|
|
|
|
|
|
|
context.dispatch('loadSpeedDials');
|
|
|
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
|
|
|
context.commit('unassignSlotFailed', error);
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|