Modal Confirm

modalConfirmStore: state => state.modalConfirmStore

this.resetModalConfirm()

this.modalAction('')

critical

watch: {
  modalConfirmStore(newVal, old) {
    if(newVal){
      if(newVal.confirmStatus){
        switch (newVal.typeModal) {
          case 'Delete_Questions':
            this.removeAllQuestion();
            break;

          default:
        }
      }
    }
  }
}

modalAction(type) {
  let modalConfig = {
    dialogVisible: true,
    typeButton: 'primary',
    typeModal: '',
    titleModal: '',
    subModal: '',
    titleButton: ''
  };

  switch (type) {
    case 'delete':
      modalConfig.typeButton = 'critical';
      modalConfig.typeModal = 'Delete_Questions';
      modalConfig.titleModal = 'Remove all questions selected.';
      modalConfig.subModal = 'This can’t be undone.';
      modalConfig.titleButton = 'Delete';
      break;

    default:
  }

  this.$store.commit('setModalConfirmStore', { ...this.modalConfirmStore, ...modalConfig });
},

Last updated

Was this helpful?