diff --git a/src/boot/axios.js b/src/boot/axios.js index 9b32275bd..99a163cca 100644 --- a/src/boot/axios.js +++ b/src/boot/axios.js @@ -5,8 +5,10 @@ import useNotify from 'src/composables/useNotify.js'; const session = useSession(); const { notify } = useNotify(); +const baseUrl = '/api/'; -axios.defaults.baseURL = '/api/'; +axios.defaults.baseURL = baseUrl; +const axiosNoError = axios.create({ baseURL: baseUrl }); const onRequest = (config) => { const token = session.getToken(); @@ -79,5 +81,7 @@ const onResponseError = (error) => { axios.interceptors.request.use(onRequest, onRequestError); axios.interceptors.response.use(onResponse, onResponseError); +axiosNoError.interceptors.request.use(onRequest); +axiosNoError.interceptors.response.use(onResponse); -export { onRequest, onResponseError }; +export { onRequest, onResponseError, axiosNoError }; diff --git a/src/components/common/VnInput.vue b/src/components/common/VnInput.vue index 570d0cbfe..26160929c 100644 --- a/src/components/common/VnInput.vue +++ b/src/components/common/VnInput.vue @@ -67,9 +67,13 @@ const mixinRules = [ requiredFieldRule, ...($attrs.rules ?? []), (val) => { - const { min } = vnInputRef.value.$attrs; + const { min, max } = vnInputRef.value.$attrs; if (!min) return null; if (min >= 0) if (Math.floor(val) < min) return t('inputMin', { value: min }); + if (!max) return null; + if (max > 0) { + if (Math.floor(val) > max) return t('inputMax', { value: max }); + } }, ]; @@ -116,8 +120,10 @@ const mixinRules = [ en: inputMin: Must be more than {value} + inputMax: Must be less than {value} es: inputMin: Debe ser mayor a {value} + inputMax: Debe ser menor a {value}