import showIssLoadingModal from '@/helpers/loading-modal-helper';

export default {
    mounted() {
        showIssLoadingModal(false);
    },
    methods: {
        onSubmit() {
        /**
         *  DO NOT REMOVE;
         *  Needed to prevent default form submit behavior.
         *  Cannot use .prevent modifier for vee-validate Form.
         */
        },
        onInvalidSubmit({ errors }) {
        /**
         * Identify the first error field and put focus on it
         * get error names array
         */
            const errorNames = errors ? Object.keys(errors) : [];
            const firstErrorEl = errorNames[0];
            if (firstErrorEl) {
                const qsString = `[name="${firstErrorEl}"]`;
                const el = document.querySelector(qsString);
                if (el !== null) {
                    el.focus();
                }
            }
        }
    }
};
