diff --git a/src/components/EditPictureForm.vue b/src/components/EditPictureForm.vue index cd6107aca..1f158e785 100644 --- a/src/components/EditPictureForm.vue +++ b/src/components/EditPictureForm.vue @@ -156,26 +156,22 @@ const rotateRight = () => { }; const onSubmit = () => { - try { - if (!newPhoto.files && !newPhoto.url) { - notify(t('Select an image'), 'negative'); - return; - } - - const options = { - type: 'blob', - }; - - editor.value - .result(options) - .then((result) => { - const file = new File([result], newPhoto.files?.name || ''); - newPhoto.blob = file; - }) - .then(() => makeRequest()); - } catch (err) { - console.error('Error uploading image'); + if (!newPhoto.files && !newPhoto.url) { + notify(t('Select an image'), 'negative'); + return; } + + const options = { + type: 'blob', + }; + + editor.value + .result(options) + .then((result) => { + const file = new File([result], newPhoto.files?.name || ''); + newPhoto.blob = file; + }) + .then(() => makeRequest()); }; const makeRequest = async () => { diff --git a/src/components/EditTableCellValueForm.vue b/src/components/EditTableCellValueForm.vue index 14709e884..7755df9ab 100644 --- a/src/components/EditTableCellValueForm.vue +++ b/src/components/EditTableCellValueForm.vue @@ -51,21 +51,17 @@ const onDataSaved = () => { }; const onSubmit = async () => { - try { - isLoading.value = true; - const rowsToEdit = $props.rows.map((row) => ({ id: row.id, itemFk: row.itemFk })); - const payload = { - field: selectedField.value.field, - newValue: newValue.value, - lines: rowsToEdit, - }; + isLoading.value = true; + const rowsToEdit = $props.rows.map((row) => ({ id: row.id, itemFk: row.itemFk })); + const payload = { + field: selectedField.value.field, + newValue: newValue.value, + lines: rowsToEdit, + }; - await axios.post($props.editUrl, payload); - onDataSaved(); - isLoading.value = false; - } catch (err) { - console.error('Error submitting table cell edit'); - } + await axios.post($props.editUrl, payload); + onDataSaved(); + isLoading.value = false; }; const closeForm = () => { diff --git a/src/components/FilterItemForm.vue b/src/components/FilterItemForm.vue index 1cf36deeb..5c3d47415 100644 --- a/src/components/FilterItemForm.vue +++ b/src/components/FilterItemForm.vue @@ -84,34 +84,30 @@ const tableColumns = computed(() => [ ]); const onSubmit = async () => { - try { - let filter = itemFilter; - const params = itemFilterParams; - const where = {}; - for (let key in params) { - const value = params[key]; - if (!value) continue; + let filter = itemFilter; + const params = itemFilterParams; + const where = {}; + for (let key in params) { + const value = params[key]; + if (!value) continue; - switch (key) { - case 'name': - where[key] = { like: `%${value}%` }; - break; - case 'producerFk': - case 'typeFk': - case 'size': - case 'inkFk': - where[key] = value; - } + switch (key) { + case 'name': + where[key] = { like: `%${value}%` }; + break; + case 'producerFk': + case 'typeFk': + case 'size': + case 'inkFk': + where[key] = value; } - filter.where = where; - - const { data } = await axios.get(props.url, { - params: { filter: JSON.stringify(filter) }, - }); - tableRows.value = data; - } catch (err) { - console.error('Error fetching entries items'); } + filter.where = where; + + const { data } = await axios.get(props.url, { + params: { filter: JSON.stringify(filter) }, + }); + tableRows.value = data; }; const closeForm = () => { diff --git a/src/components/FilterTravelForm.vue b/src/components/FilterTravelForm.vue index c84772d9b..6eb44bd01 100644 --- a/src/components/FilterTravelForm.vue +++ b/src/components/FilterTravelForm.vue @@ -86,32 +86,28 @@ const tableColumns = computed(() => [ ]); const onSubmit = async () => { - try { - let filter = travelFilter; - const params = travelFilterParams; - const where = {}; - for (let key in params) { - const value = params[key]; - if (!value) continue; + let filter = travelFilter; + const params = travelFilterParams; + const where = {}; + for (let key in params) { + const value = params[key]; + if (!value) continue; - switch (key) { - case 'agencyModeFk': - case 'warehouseInFk': - case 'warehouseOutFk': - case 'shipped': - case 'landed': - where[key] = value; - } + switch (key) { + case 'agencyModeFk': + case 'warehouseInFk': + case 'warehouseOutFk': + case 'shipped': + case 'landed': + where[key] = value; } - - filter.where = where; - const { data } = await axios.get('Travels', { - params: { filter: JSON.stringify(filter) }, - }); - tableRows.value = data; - } catch (err) { - console.error('Error fetching travels'); } + + filter.where = where; + const { data } = await axios.get('Travels', { + params: { filter: JSON.stringify(filter) }, + }); + tableRows.value = data; }; const closeForm = () => { diff --git a/src/components/FormModel.vue b/src/components/FormModel.vue index 05f947cf3..9ac2d38a5 100644 --- a/src/components/FormModel.vue +++ b/src/components/FormModel.vue @@ -217,9 +217,6 @@ async function save() { updateAndEmit('onDataSaved', formData.value, response?.data); if ($props.reload) await arrayData.fetch({}); hasChanges.value = false; - } catch (err) { - console.error(err); - notify('errors.writeRequest', 'negative'); } finally { isLoading.value = false; } diff --git a/src/components/ItemsFilterPanel.vue b/src/components/ItemsFilterPanel.vue index e89d32da4..5fc5f3d12 100644 --- a/src/components/ItemsFilterPanel.vue +++ b/src/components/ItemsFilterPanel.vue @@ -88,20 +88,16 @@ const applyTags = (params, search) => { }; const fetchItemTypes = async (id) => { - try { - const filter = { - fields: ['id', 'name', 'categoryFk'], - where: { categoryFk: id }, - include: 'category', - order: 'name ASC', - }; - const { data } = await axios.get('ItemTypes', { - params: { filter: JSON.stringify(filter) }, - }); - itemTypesOptions.value = data; - } catch (err) { - console.error('Error fetching item types', err); - } + const filter = { + fields: ['id', 'name', 'categoryFk'], + where: { categoryFk: id }, + include: 'category', + order: 'name ASC', + }; + const { data } = await axios.get('ItemTypes', { + params: { filter: JSON.stringify(filter) }, + }); + itemTypesOptions.value = data; }; const getCategoryClass = (category, params) => { @@ -111,23 +107,19 @@ const getCategoryClass = (category, params) => { }; const getSelectedTagValues = async (tag) => { - try { - if (!tag?.selectedTag?.id) return; - tag.value = null; - const filter = { - fields: ['value'], - order: 'value ASC', - limit: 30, - }; + if (!tag?.selectedTag?.id) return; + tag.value = null; + const filter = { + fields: ['value'], + order: 'value ASC', + limit: 30, + }; - const params = { filter: JSON.stringify(filter) }; - const { data } = await axios.get(`Tags/${tag.selectedTag.id}/filterValue`, { - params, - }); - tag.valueOptions = data; - } catch (err) { - console.error('Error getting selected tag values'); - } + const params = { filter: JSON.stringify(filter) }; + const { data } = await axios.get(`Tags/${tag.selectedTag.id}/filterValue`, { + params, + }); + tag.valueOptions = data; }; const removeTag = (index, params, search) => { diff --git a/src/components/RefundInvoiceForm.vue b/src/components/RefundInvoiceForm.vue index 9d9f0cff1..590acede0 100644 --- a/src/components/RefundInvoiceForm.vue +++ b/src/components/RefundInvoiceForm.vue @@ -39,14 +39,10 @@ const refund = async () => { invoiceCorrectionTypeFk: invoiceParams.invoiceCorrectionTypeFk, }; - try { - const { data } = await axios.post('InvoiceOuts/refundAndInvoice', params); - notify(t('Refunded invoice'), 'positive'); - const [id] = data?.refundId || []; - if (id) router.push({ name: 'InvoiceOutSummary', params: { id } }); - } catch (err) { - console.error('Error refunding invoice', err); - } + const { data } = await axios.post('InvoiceOuts/refundAndInvoice', params); + notify(t('Refunded invoice'), 'positive'); + const [id] = data?.refundId || []; + if (id) router.push({ name: 'InvoiceOutSummary', params: { id } }); }; diff --git a/src/components/TransferInvoiceForm.vue b/src/components/TransferInvoiceForm.vue index f7050cdba..aa71070d6 100644 --- a/src/components/TransferInvoiceForm.vue +++ b/src/components/TransferInvoiceForm.vue @@ -49,36 +49,32 @@ const makeInvoice = async () => { makeInvoice: checked.value, }; - try { - if (checked.value && hasToInvoiceByAddress) { - const response = await new Promise((resolve) => { - quasar - .dialog({ - component: VnConfirm, - componentProps: { - title: t('Bill destination client'), - message: t('transferInvoiceInfo'), - }, - }) - .onOk(() => { - resolve(true); - }) - .onCancel(() => { - resolve(false); - }); - }); - if (!response) { - return; - } + if (checked.value && hasToInvoiceByAddress) { + const response = await new Promise((resolve) => { + quasar + .dialog({ + component: VnConfirm, + componentProps: { + title: t('Bill destination client'), + message: t('transferInvoiceInfo'), + }, + }) + .onOk(() => { + resolve(true); + }) + .onCancel(() => { + resolve(false); + }); + }); + if (!response) { + return; } - - const { data } = await axios.post('InvoiceOuts/transfer', params); - notify(t('Transferred invoice'), 'positive'); - const id = data?.[0]; - if (id) router.push({ name: 'InvoiceOutSummary', params: { id } }); - } catch (err) { - console.error('Error transfering invoice', err); } + + const { data } = await axios.post('InvoiceOuts/transfer', params); + notify(t('Transferred invoice'), 'positive'); + const id = data?.[0]; + if (id) router.push({ name: 'InvoiceOutSummary', params: { id } }); }; diff --git a/src/components/VnTable/VnVisibleColumn.vue b/src/components/VnTable/VnVisibleColumn.vue index f5c3458cd..57b1fdf21 100644 --- a/src/components/VnTable/VnVisibleColumn.vue +++ b/src/components/VnTable/VnVisibleColumn.vue @@ -57,31 +57,27 @@ async function getConfig(url, filter) { } async function fetchViewConfigData() { - try { - const defaultFilter = { - where: { tableCode: $props.tableCode }, - }; + const defaultFilter = { + where: { tableCode: $props.tableCode }, + }; - const userConfig = await getConfig('UserConfigViews', { - where: { - ...defaultFilter.where, - ...{ userFk: user.value.id }, - }, - }); + const userConfig = await getConfig('UserConfigViews', { + where: { + ...defaultFilter.where, + ...{ userFk: user.value.id }, + }, + }); - if (userConfig) { - initialUserConfigViewData.value = userConfig; - setUserConfigViewData(userConfig.configuration); - return; - } + if (userConfig) { + initialUserConfigViewData.value = userConfig; + setUserConfigViewData(userConfig.configuration); + return; + } - const defaultConfig = await getConfig('DefaultViewConfigs', defaultFilter); - if (defaultConfig) { - setUserConfigViewData(defaultConfig.columns); - return; - } - } catch (err) { - console.error('Error fetching config view data', err); + const defaultConfig = await getConfig('DefaultViewConfigs', defaultFilter); + if (defaultConfig) { + setUserConfigViewData(defaultConfig.columns); + return; } } @@ -92,7 +88,6 @@ async function saveConfig() { setUserConfigViewData(configuration, true); if (!$props.tableCode) return popupProxyRef.value.hide(); - try { const params = {}; // Si existe una view config del usuario hacemos un update si no la creamos if (initialUserConfigViewData.value) { @@ -123,10 +118,7 @@ async function saveConfig() { } notify('globals.dataSaved', 'positive'); popupProxyRef.value.hide(); - } catch (err) { - console.error('Error saving user view config', err); - notify('errors.writeRequest', 'negative'); - } + } onMounted(async () => { diff --git a/src/components/common/TableVisibleColumns.vue b/src/components/common/TableVisibleColumns.vue index 9a6c70ef0..ee1e56319 100644 --- a/src/components/common/TableVisibleColumns.vue +++ b/src/components/common/TableVisibleColumns.vue @@ -58,79 +58,71 @@ const getConfig = async (url, filter) => { }; const fetchViewConfigData = async () => { - try { - const userConfigFilter = { - where: { tableCode: $props.tableCode, userFk: user.value.id }, - }; - const userConfig = await getConfig('UserConfigViews', userConfigFilter); + const userConfigFilter = { + where: { tableCode: $props.tableCode, userFk: user.value.id }, + }; + const userConfig = await getConfig('UserConfigViews', userConfigFilter); - if (userConfig) { - initialUserConfigViewData.value = userConfig; - setUserConfigViewData(userConfig.configuration); - return; - } + if (userConfig) { + initialUserConfigViewData.value = userConfig; + setUserConfigViewData(userConfig.configuration); + return; + } - const defaultConfigFilter = { where: { tableCode: $props.tableCode } }; - const defaultConfig = await getConfig('DefaultViewConfigs', defaultConfigFilter); + const defaultConfigFilter = { where: { tableCode: $props.tableCode } }; + const defaultConfig = await getConfig('DefaultViewConfigs', defaultConfigFilter); - if (defaultConfig) { - // Si el backend devuelve una configuración por defecto la usamos - setUserConfigViewData(defaultConfig.columns); - return; - } else { - // Si no hay configuración por defecto mostramos todas las columnas - const defaultColumns = {}; - $props.allColumns.forEach((col) => (defaultColumns[col] = true)); - setUserConfigViewData(defaultColumns); - } - } catch (err) { - console.error('Error fetching config view data', err); + if (defaultConfig) { + // Si el backend devuelve una configuración por defecto la usamos + setUserConfigViewData(defaultConfig.columns); + return; + } else { + // Si no hay configuración por defecto mostramos todas las columnas + const defaultColumns = {}; + $props.allColumns.forEach((col) => (defaultColumns[col] = true)); + setUserConfigViewData(defaultColumns); } }; const saveConfig = async () => { - try { - const params = {}; - const configuration = {}; + const params = {}; + const configuration = {}; - formattedCols.value.forEach((col) => { - const { name, active } = col; - configuration[name] = active; - }); + formattedCols.value.forEach((col) => { + const { name, active } = col; + configuration[name] = active; + }); - // Si existe una view config del usuario hacemos un update si no la creamos - if (initialUserConfigViewData.value) { - params.updates = [ - { - data: { - configuration: configuration, - }, - where: { - id: initialUserConfigViewData.value.id, - }, - }, - ]; - } else { - params.creates = [ - { - userFk: user.value.id, - tableCode: $props.tableCode, - tableConfig: $props.tableCode, + // Si existe una view config del usuario hacemos un update si no la creamos + if (initialUserConfigViewData.value) { + params.updates = [ + { + data: { configuration: configuration, }, - ]; - } - - const response = await axios.post('UserConfigViews/crud', params); - if (response.data && response.data[0]) { - initialUserConfigViewData.value = response.data[0]; - } - emitSavedConfig(); - notify('globals.dataSaved', 'positive'); - popupProxyRef.value.hide(); - } catch (err) { - console.error('Error saving user view config', err); + where: { + id: initialUserConfigViewData.value.id, + }, + }, + ]; + } else { + params.creates = [ + { + userFk: user.value.id, + tableCode: $props.tableCode, + tableConfig: $props.tableCode, + configuration: configuration, + }, + ]; } + + const response = await axios.post('UserConfigViews/crud', params); + if (response.data && response.data[0]) { + initialUserConfigViewData.value = response.data[0]; + } + emitSavedConfig(); + notify('globals.dataSaved', 'positive'); + popupProxyRef.value.hide(); }; const emitSavedConfig = () => { diff --git a/src/pages/Account/AccountAccounts.vue b/src/pages/Account/AccountAccounts.vue index 9cc282551..d75f6359f 100644 --- a/src/pages/Account/AccountAccounts.vue +++ b/src/pages/Account/AccountAccounts.vue @@ -11,21 +11,13 @@ const { t } = useI18n(); const { notify } = useNotify(); const onSynchronizeAll = async () => { - try { - notify(t('Synchronizing in the background'), 'positive'); - await axios.patch(`Accounts/syncAll`); - } catch (error) { - console.error('Error synchronizing all accounts', error); - } + notify(t('Synchronizing in the background'), 'positive'); + await axios.patch(`Accounts/syncAll`); }; const onSynchronizeRoles = async () => { - try { - await axios.patch(`RoleInherits/sync`); - notify(t('Roles synchronized!'), 'positive'); - } catch (error) { - console.error('Error synchronizing roles', error); - } + await axios.patch(`RoleInherits/sync`); + notify(t('Roles synchronized!'), 'positive'); }; diff --git a/src/pages/Account/AccountAcls.vue b/src/pages/Account/AccountAcls.vue index dd93a0cb5..d073fcfd2 100644 --- a/src/pages/Account/AccountAcls.vue +++ b/src/pages/Account/AccountAcls.vue @@ -94,29 +94,25 @@ const columns = computed(() => [ }, ]); const deleteAcl = async ({ id }) => { - try { - await new Promise((resolve) => { - quasar - .dialog({ - component: VnConfirm, - componentProps: { - title: t('Remove ACL'), - message: t('Do you want to remove this ACL?'), - }, - }) - .onOk(() => { - resolve(true); - }) - .onCancel(() => { - resolve(false); - }); - }); - await axios.delete(`ACLs/${id}`); - tableRef.value.reload(); - notify('ACL removed', 'positive'); - } catch (error) { - console.error('Error deleting Acl: ', error); - } + await new Promise((resolve) => { + quasar + .dialog({ + component: VnConfirm, + componentProps: { + title: t('Remove ACL'), + message: t('Do you want to remove this ACL?'), + }, + }) + .onOk(() => { + resolve(true); + }) + .onCancel(() => { + resolve(false); + }); + }); + await axios.delete(`ACLs/${id}`); + tableRef.value.reload(); + notify('ACL removed', 'positive'); }; diff --git a/src/pages/Account/AccountConnections.vue b/src/pages/Account/AccountConnections.vue index 057745831..ba4ed49c8 100644 --- a/src/pages/Account/AccountConnections.vue +++ b/src/pages/Account/AccountConnections.vue @@ -34,13 +34,9 @@ const refresh = () => paginateRef.value.fetch(); const navigate = (id) => router.push({ name: 'AccountSummary', params: { id } }); const killSession = async ({ userId, created }) => { - try { - await axios.post(`${urlPath}/killSession`, { userId, created }); - paginateRef.value.fetch(); - notify(t('Session killed'), 'positive'); - } catch (error) { - console.error('Error killing session', error); - } + await axios.post(`${urlPath}/killSession`, { userId, created }); + paginateRef.value.fetch(); + notify(t('Session killed'), 'positive'); }; diff --git a/src/pages/Account/AccountLdap.vue b/src/pages/Account/AccountLdap.vue index 7b8433e73..2b61c647d 100644 --- a/src/pages/Account/AccountLdap.vue +++ b/src/pages/Account/AccountLdap.vue @@ -40,12 +40,8 @@ const formUrlCreate = ref(null); const formUrlUpdate = ref(null); const formCustomFn = ref(null); const onTestConection = async () => { - try { - await axios.get(`LdapConfigs/test`); - notify(t('LDAP connection established!'), 'positive'); - } catch (error) { - console.error('Error testing connection', error); - } + await axios.get(`LdapConfigs/test`); + notify(t('LDAP connection established!'), 'positive'); }; const getInitialLdapConfig = async () => { try { @@ -72,14 +68,10 @@ const getInitialLdapConfig = async () => { } }; const deleteMailForward = async () => { - try { - await axios.delete(URL_UPDATE); - initialData.value = { ...DEFAULT_DATA }; - hasData.value = false; - notify(t('globals.dataSaved'), 'positive'); - } catch (err) { - console.error('Error deleting mail forward', err); - } + await axios.delete(URL_UPDATE); + initialData.value = { ...DEFAULT_DATA }; + hasData.value = false; + notify(t('globals.dataSaved'), 'positive'); }; onMounted(async () => await getInitialLdapConfig()); diff --git a/src/pages/Account/AccountSamba.vue b/src/pages/Account/AccountSamba.vue index 7af9f4364..73c871922 100644 --- a/src/pages/Account/AccountSamba.vue +++ b/src/pages/Account/AccountSamba.vue @@ -46,12 +46,8 @@ const formUrlUpdate = ref(null); const formCustomFn = ref(null); const onTestConection = async () => { - try { - await axios.get(`SambaConfigs/test`); - notify(t('Samba connection established!'), 'positive'); - } catch (error) { - console.error('Error testing connection', error); - } + await axios.get(`SambaConfigs/test`); + notify(t('Samba connection established!'), 'positive'); }; const getInitialSambaConfig = async () => { @@ -79,14 +75,10 @@ const getInitialSambaConfig = async () => { }; const deleteMailForward = async () => { - try { - await axios.delete(URL_UPDATE); - initialData.value = { ...DEFAULT_DATA }; - hasData.value = false; - notify(t('globals.dataSaved'), 'positive'); - } catch (err) { - console.error('Error deleting mail forward', err); - } + await axios.delete(URL_UPDATE); + initialData.value = { ...DEFAULT_DATA }; + hasData.value = false; + notify(t('globals.dataSaved'), 'positive'); }; onMounted(async () => await getInitialSambaConfig()); diff --git a/src/pages/Account/Alias/Card/AliasDescriptor.vue b/src/pages/Account/Alias/Card/AliasDescriptor.vue index 963f84547..dc06ef504 100644 --- a/src/pages/Account/Alias/Card/AliasDescriptor.vue +++ b/src/pages/Account/Alias/Card/AliasDescriptor.vue @@ -44,13 +44,9 @@ const removeAlias = () => { cancel: true, }) .onOk(async () => { - try { - await axios.delete(`MailAliases/${entityId.value}`); - notify(t('Alias removed'), 'positive'); - router.push({ name: 'AccountAlias' }); - } catch (err) { - console.error('Error removing alias'); - } + await axios.delete(`MailAliases/${entityId.value}`); + notify(t('Alias removed'), 'positive'); + router.push({ name: 'AccountAlias' }); }); }; diff --git a/src/pages/Account/Alias/Card/AliasUsers.vue b/src/pages/Account/Alias/Card/AliasUsers.vue index 4a9c449e4..4aad68f1a 100644 --- a/src/pages/Account/Alias/Card/AliasUsers.vue +++ b/src/pages/Account/Alias/Card/AliasUsers.vue @@ -46,13 +46,9 @@ const columns = computed(() => [ ]); const deleteAlias = async (row) => { - try { - await axios.delete(`${urlPath.value}/${row.id}`); - notify(t('User removed'), 'positive'); - fetchAliases(); - } catch (error) { - console.error(error); - } + await axios.delete(`${urlPath.value}/${row.id}`); + notify(t('User removed'), 'positive'); + fetchAliases(); }; watch( diff --git a/src/pages/Account/Card/AccountMailAlias.vue b/src/pages/Account/Card/AccountMailAlias.vue index 15d03c665..8d3bd3b67 100644 --- a/src/pages/Account/Card/AccountMailAlias.vue +++ b/src/pages/Account/Card/AccountMailAlias.vue @@ -61,23 +61,15 @@ const fetchAccountExistence = async () => { }; const deleteMailAlias = async (row) => { - try { - await axios.delete(`${urlPath}/${row.id}`); - fetchMailAliases(); - notify(t('Unsubscribed from alias!'), 'positive'); - } catch (error) { - console.error(error); - } + await axios.delete(`${urlPath}/${row.id}`); + fetchMailAliases(); + notify(t('Unsubscribed from alias!'), 'positive'); }; const createMailAlias = async (mailAliasFormData) => { - try { - await axios.post(urlPath, mailAliasFormData); - notify(t('Subscribed to alias!'), 'positive'); - fetchMailAliases(); - } catch (error) { - console.error(error); - } + await axios.post(urlPath, mailAliasFormData); + notify(t('Subscribed to alias!'), 'positive'); + fetchMailAliases(); }; const fetchMailAliases = async () => { diff --git a/src/pages/Account/Card/AccountMailForwarding.vue b/src/pages/Account/Card/AccountMailForwarding.vue index 24b30f2b3..aa92e5072 100644 --- a/src/pages/Account/Card/AccountMailForwarding.vue +++ b/src/pages/Account/Card/AccountMailForwarding.vue @@ -41,35 +41,22 @@ const fetchAccountExistence = async () => { }; const fetchMailForwards = async () => { - try { - const response = await axios.get(`MailForwards/${route.params.id}`); - return response.data; - } catch (err) { - console.error('Error fetching mail forwards', err); - return null; - } + const response = await axios.get(`MailForwards/${route.params.id}`); + return response.data; }; const deleteMailForward = async () => { - try { - await axios.delete(`MailForwards/${route.params.id}`); - formData.value.forwardTo = null; - initialData.value.forwardTo = null; - initialData.value.hasData = hasData.value; - notify(t('globals.dataSaved'), 'positive'); - } catch (err) { - console.error('Error deleting mail forward', err); - } + await axios.delete(`MailForwards/${route.params.id}`); + formData.value.forwardTo = null; + initialData.value.forwardTo = null; + initialData.value.hasData = hasData.value; + notify(t('globals.dataSaved'), 'positive'); }; const updateMailForward = async () => { - try { - await axios.patch('MailForwards', formData.value); - initialData.value = { ...formData.value }; - initialData.value.hasData = hasData.value; - } catch (err) { - console.error('Error creating mail forward', err); - } + await axios.patch('MailForwards', formData.value); + initialData.value = { ...formData.value }; + initialData.value.hasData = hasData.value; }; const onSubmit = async () => { diff --git a/src/pages/Account/Role/Card/RoleDescriptor.vue b/src/pages/Account/Role/Card/RoleDescriptor.vue index e4af3ed13..1ad3b146a 100644 --- a/src/pages/Account/Role/Card/RoleDescriptor.vue +++ b/src/pages/Account/Role/Card/RoleDescriptor.vue @@ -32,12 +32,8 @@ const filter = { where: { id: entityId }, }; const removeRole = async () => { - try { - await axios.delete(`VnRoles/${entityId.value}`); - notify(t('Role removed'), 'positive'); - } catch (error) { - console.error('Error deleting role', error); - } + await axios.delete(`VnRoles/${entityId.value}`); + notify(t('Role removed'), 'positive'); }; diff --git a/src/pages/Account/Role/Card/SubRoles.vue b/src/pages/Account/Role/Card/SubRoles.vue index d17f96dd8..2d119c93a 100644 --- a/src/pages/Account/Role/Card/SubRoles.vue +++ b/src/pages/Account/Role/Card/SubRoles.vue @@ -46,29 +46,19 @@ const columns = computed(() => [ ]); const deleteSubRole = async (row) => { - try { - await axios.delete(`${urlPath.value}/${row.id}`); - fetchSubRoles(); - notify( - t('Role removed. Changes will take a while to fully propagate.'), - 'positive' - ); - } catch (error) { - console.error(error); - } + await axios.delete(`${urlPath.value}/${row.id}`); + fetchSubRoles(); + notify(t('Role removed. Changes will take a while to fully propagate.'), 'positive'); }; const createSubRole = async (subRoleFormData) => { - try { await axios.post(urlPath.value, subRoleFormData); notify( t('Role added! Changes will take a while to fully propagate.'), 'positive' ); fetchSubRoles(); - } catch (error) { - console.error(error); - } + }; watch( diff --git a/src/pages/Customer/components/CustomerSamplesCreate.vue b/src/pages/Customer/components/CustomerSamplesCreate.vue index 8c59f28b6..a75dfa1b2 100644 --- a/src/pages/Customer/components/CustomerSamplesCreate.vue +++ b/src/pages/Customer/components/CustomerSamplesCreate.vue @@ -106,28 +106,24 @@ const setParams = (params) => { }; const getPreview = async () => { - try { - const params = { - recipientId: entityId, - }; - const validationMessage = validateMessage(); - if (validationMessage) return notify(t(validationMessage), 'negative'); + const params = { + recipientId: entityId, + }; + const validationMessage = validateMessage(); + if (validationMessage) return notify(t(validationMessage), 'negative'); - setParams(params); + setParams(params); - const path = `${sampleType.value.model}/${entityId.value}/${sampleType.value.code}-html`; - const { data } = await axios.get(path, { params }); + const path = `${sampleType.value.model}/${entityId.value}/${sampleType.value.code}-html`; + const { data } = await axios.get(path, { params }); - if (!data) return; - quasar.dialog({ - component: CustomerSamplesPreview, - componentProps: { - htmlContent: data, - }, - }); - } catch (err) { - notify('Errors getting preview', 'negative'); - } + if (!data) return; + quasar.dialog({ + component: CustomerSamplesPreview, + componentProps: { + htmlContent: data, + }, + }); }; const onSubmit = async () => { diff --git a/src/pages/Department/Card/DepartmentDescriptor.vue b/src/pages/Department/Card/DepartmentDescriptor.vue index e914f6af6..39b8d54b5 100644 --- a/src/pages/Department/Card/DepartmentDescriptor.vue +++ b/src/pages/Department/Card/DepartmentDescriptor.vue @@ -42,13 +42,9 @@ const setData = (entity) => { }; const removeDepartment = async () => { - try { - await axios.post(`/Departments/${entityId.value}/removeChild`, entityId.value); - router.push({ name: 'WorkerDepartment' }); - notify('department.departmentRemoved', 'positive'); - } catch (err) { - console.error('Error removing department'); - } + await axios.post(`/Departments/${entityId.value}/removeChild`, entityId.value); + router.push({ name: 'WorkerDepartment' }); + notify('department.departmentRemoved', 'positive'); }; const { openConfirmationModal } = useVnConfirm(); diff --git a/src/pages/Entry/Card/EntryBuys.vue b/src/pages/Entry/Card/EntryBuys.vue index ff89faada..c59a0e711 100644 --- a/src/pages/Entry/Card/EntryBuys.vue +++ b/src/pages/Entry/Card/EntryBuys.vue @@ -237,13 +237,9 @@ const copyOriginalRowsData = (rows) => { }; const saveChange = async (field, { rowIndex, row }) => { - try { - if (originalRowDataCopy.value[rowIndex][field] == row[field]) return; - await axios.patch(`Buys/${row.id}`, row); - originalRowDataCopy.value[rowIndex][field] = row[field]; - } catch (err) { - console.error('Error saving changes', err); - } + if (originalRowDataCopy.value[rowIndex][field] == row[field]) return; + await axios.patch(`Buys/${row.id}`, row); + originalRowDataCopy.value[rowIndex][field] = row[field]; }; const openRemoveDialog = async () => { @@ -261,15 +257,11 @@ const openRemoveDialog = async () => { }, }) .onOk(async () => { - try { - await deleteBuys(); - const notifyMessage = t( - `Buy${rowsSelected.value.length > 1 ? 's' : ''} deleted` - ); - notify(notifyMessage, 'positive'); - } catch (err) { - console.error('Error deleting buys'); - } + await deleteBuys(); + const notifyMessage = t( + `Buy${rowsSelected.value.length > 1 ? 's' : ''} deleted` + ); + notify(notifyMessage, 'positive'); }); }; @@ -283,17 +275,13 @@ const importBuys = () => { }; const toggleGroupingMode = async (buy, mode) => { - try { - const groupingMode = mode === 'grouping' ? mode : 'packing'; - const newGroupingMode = buy.groupingMode === groupingMode ? null : groupingMode; - const params = { - groupingMode: newGroupingMode, - }; - await axios.patch(`Buys/${buy.id}`, params); - buy.groupingMode = newGroupingMode; - } catch (err) { - console.error('Error toggling grouping mode'); - } + const groupingMode = mode === 'grouping' ? mode : 'packing'; + const newGroupingMode = buy.groupingMode === groupingMode ? null : groupingMode; + const params = { + groupingMode: newGroupingMode, + }; + await axios.patch(`Buys/${buy.id}`, params); + buy.groupingMode = newGroupingMode; }; const lockIconType = (groupingMode, mode) => { diff --git a/src/pages/Entry/Card/EntryBuysImport.vue b/src/pages/Entry/Card/EntryBuysImport.vue index 8431e1096..007231b43 100644 --- a/src/pages/Entry/Card/EntryBuysImport.vue +++ b/src/pages/Entry/Card/EntryBuysImport.vue @@ -123,36 +123,28 @@ const fillData = async (rawData) => { }; const fetchBuys = async (buys) => { - try { - const params = { buys }; - const { data } = await axios.post( - `Entries/${route.params.id}/importBuysPreview`, - params - ); - importData.value.buys = data; - } catch (err) { - console.error('Error fetching buys'); - } + const params = { buys }; + const { data } = await axios.post( + `Entries/${route.params.id}/importBuysPreview`, + params + ); + importData.value.buys = data; }; const onSubmit = async () => { - try { - const params = importData.value; - const hasAnyEmptyRow = params.buys.some((buy) => { - return buy.itemFk === null; - }); + const params = importData.value; + const hasAnyEmptyRow = params.buys.some((buy) => { + return buy.itemFk === null; + }); - if (hasAnyEmptyRow) { - notify(t('Some of the imported buys does not have an item'), 'negative'); - return; - } - - await axios.post(`Entries/${route.params.id}/importBuys`, params); - notify('globals.dataSaved', 'positive'); - redirectToBuysView(); - } catch (err) { - console.error('Error importing buys', err); + if (hasAnyEmptyRow) { + notify(t('Some of the imported buys does not have an item'), 'negative'); + return; } + + await axios.post(`Entries/${route.params.id}/importBuys`, params); + notify('globals.dataSaved', 'positive'); + redirectToBuysView(); }; const redirectToBuysView = () => { diff --git a/src/pages/Entry/Card/EntrySummary.vue b/src/pages/Entry/Card/EntrySummary.vue index c2f1e6b57..bc333758a 100644 --- a/src/pages/Entry/Card/EntrySummary.vue +++ b/src/pages/Entry/Card/EntrySummary.vue @@ -147,12 +147,9 @@ async function setEntryData(data) { } const fetchEntryBuys = async () => { - try { const { data } = await axios.get(`Entries/${entry.value.id}/getBuys`); if (data) entryBuys.value = data; - } catch (err) { - console.error('Error fetching entry buys'); - } + }; diff --git a/src/pages/Entry/EntryWasteRecalc.vue b/src/pages/Entry/EntryWasteRecalc.vue index cd823beb4..6ae200ed7 100644 --- a/src/pages/Entry/EntryWasteRecalc.vue +++ b/src/pages/Entry/EntryWasteRecalc.vue @@ -30,8 +30,6 @@ const recalc = async () => { isLoading.value = true; await axios.post('Applications/waste_addSales/execute-proc', params); notify('wasteRecalc.recalcOk', 'positive'); - } catch (err) { - console.error(err); } finally { isLoading.value = false; } diff --git a/src/pages/InvoiceOut/Card/InvoiceOutDescriptorMenu.vue b/src/pages/InvoiceOut/Card/InvoiceOutDescriptorMenu.vue index 70d38cb93..eb72563e1 100644 --- a/src/pages/InvoiceOut/Card/InvoiceOutDescriptorMenu.vue +++ b/src/pages/InvoiceOut/Card/InvoiceOutDescriptorMenu.vue @@ -61,25 +61,18 @@ const showSendInvoiceDialog = (type) => { }; const sendEmailInvoice = async ({ address }) => { - try { - if (!address) notify(`The email can't be empty`, 'negative'); + if (!address) notify(`The email can't be empty`, 'negative'); - if (invoiceFormType.value === 'pdf') { - return sendEmail(`InvoiceOuts/${$props.invoiceOutData.ref}/invoice-email`, { - recipientId: $props.invoiceOutData.client.id, - recipient: address, - }); - } else { - return sendEmail( - `InvoiceOuts/${$props.invoiceOutData.ref}/invoice-csv-email`, - { - recipientId: $props.invoiceOutData.client.id, - recipient: address, - } - ); - } - } catch (err) { - console.error('Error sending email', err); + if (invoiceFormType.value === 'pdf') { + return sendEmail(`InvoiceOuts/${$props.invoiceOutData.ref}/invoice-email`, { + recipientId: $props.invoiceOutData.client.id, + recipient: address, + }); + } else { + return sendEmail(`InvoiceOuts/${$props.invoiceOutData.ref}/invoice-csv-email`, { + recipientId: $props.invoiceOutData.client.id, + recipient: address, + }); } }; @@ -88,46 +81,30 @@ const redirectToInvoiceOutList = () => { }; const deleteInvoice = async () => { - try { - await axios.post(`InvoiceOuts/${$props.invoiceOutData.id}/delete`); - notify(t('InvoiceOut deleted'), 'positive'); - } catch (err) { - console.error('Error deleting invoice out', err); - } + await axios.post(`InvoiceOuts/${$props.invoiceOutData.id}/delete`); + notify(t('InvoiceOut deleted'), 'positive'); }; const bookInvoice = async () => { - try { - await axios.post(`InvoiceOuts/${$props.invoiceOutData.ref}/book`); - notify(t('InvoiceOut booked'), 'positive'); - } catch (err) { - console.error('Error booking invoice out', err); - } + await axios.post(`InvoiceOuts/${$props.invoiceOutData.ref}/book`); + notify(t('InvoiceOut booked'), 'positive'); }; const generateInvoicePdf = async () => { - try { - await axios.post(`InvoiceOuts/${$props.invoiceOutData.id}/createPdf`); - notify(t('The invoice PDF document has been regenerated'), 'positive'); - } catch (err) { - console.error('Error generating invoice out pdf', err); - } + await axios.post(`InvoiceOuts/${$props.invoiceOutData.id}/createPdf`); + notify(t('The invoice PDF document has been regenerated'), 'positive'); }; const refundInvoice = async (withWarehouse) => { - try { - const params = { ref: $props.invoiceOutData.ref, withWarehouse: withWarehouse }; - const { data } = await axios.post('InvoiceOuts/refund', params); - location.href = window.origin + `/#/ticket/${data[0].id}/sale`; - notify( - t('refundInvoiceSuccessMessage', { - refundTicket: data[0].id, - }), - 'positive' - ); - } catch (err) { - console.error('Error generating invoice out pdf', err); - } + const params = { ref: $props.invoiceOutData.ref, withWarehouse: withWarehouse }; + const { data } = await axios.post('InvoiceOuts/refund', params); + location.href = window.origin + `/#/ticket/${data[0].id}/sale`; + notify( + t('refundInvoiceSuccessMessage', { + refundTicket: data[0].id, + }), + 'positive' + ); }; const showTransferInvoiceForm = async () => { diff --git a/src/pages/InvoiceOut/InvoiceOutList.vue b/src/pages/InvoiceOut/InvoiceOutList.vue index f1b4902f2..092844386 100644 --- a/src/pages/InvoiceOut/InvoiceOutList.vue +++ b/src/pages/InvoiceOut/InvoiceOutList.vue @@ -143,15 +143,10 @@ onMounted(() => (stateStore.rightDrawer = true)); onUnmounted(() => (stateStore.rightDrawer = false)); function openPdf(id) { - try { - openReport(`${MODEL}/${id}/download`); - } catch (err) { - console.error('Error opening PDF', err); - } + openReport(`${MODEL}/${id}/download`); } function downloadPdf() { - try { if (selectedRows.value.size === 0) return; const selectedCardsArray = Array.from(selectedRows.value.values()); @@ -170,9 +165,7 @@ function downloadPdf() { openReport(`${MODEL}/downloadZip`, params); } - } catch (err) { - console.error('Error opening PDF'); - } + } watchEffect(selectedRows); diff --git a/src/pages/Item/Card/ItemDescriptor.vue b/src/pages/Item/Card/ItemDescriptor.vue index ef844824f..1e6c5c730 100644 --- a/src/pages/Item/Card/ItemDescriptor.vue +++ b/src/pages/Item/Card/ItemDescriptor.vue @@ -58,46 +58,34 @@ onMounted(async () => { const data = ref(useCardDescription()); const setData = async (entity) => { - try { - if (!entity) return; - data.value = useCardDescription(entity.name, entity.id); - await updateStock(); - } catch (err) { - console.error('Error item'); - } + if (!entity) return; + data.value = useCardDescription(entity.name, entity.id); + await updateStock(); }; const getItemConfigs = async () => { - try { - const { data } = await axios.get('ItemConfigs/findOne'); - if (!data) return; - return (warehouseConfig.value = data.warehouseFk); - } catch (err) { - console.error('Error item'); - } + const { data } = await axios.get('ItemConfigs/findOne'); + if (!data) return; + return (warehouseConfig.value = data.warehouseFk); }; const updateStock = async () => { - try { - available.value = null; - visible.value = null; + available.value = null; + visible.value = null; - const params = { - warehouseFk: $props.warehouseFk, - dated: $props.dated, - }; + const params = { + warehouseFk: $props.warehouseFk, + dated: $props.dated, + }; - await getItemConfigs(); - if (!params.warehouseFk) { - params.warehouseFk = warehouseConfig.value; - } - const { data } = await axios.get(`Items/${entityId.value}/getVisibleAvailable`, { - params, - }); - available.value = data.available; - visible.value = data.visible; - } catch (err) { - console.error('Error updating stock'); + await getItemConfigs(); + if (!params.warehouseFk) { + params.warehouseFk = warehouseConfig.value; } + const { data } = await axios.get(`Items/${entityId.value}/getVisibleAvailable`, { + params, + }); + available.value = data.available; + visible.value = data.visible; }; const openRegularizeStockForm = () => { @@ -105,12 +93,8 @@ const openRegularizeStockForm = () => { }; const cloneItem = async () => { - try { - const { data } = await axios.post(`Items/${entityId.value}/clone`); - router.push({ name: 'ItemTags', params: { id: data.id } }); - } catch (err) { - console.error('Error cloning item'); - } + const { data } = await axios.post(`Items/${entityId.value}/clone`); + router.push({ name: 'ItemTags', params: { id: data.id } }); }; const openCloneDialog = async () => { diff --git a/src/pages/Item/Card/ItemShelving.vue b/src/pages/Item/Card/ItemShelving.vue index 41cb34c03..27e265e6b 100644 --- a/src/pages/Item/Card/ItemShelving.vue +++ b/src/pages/Item/Card/ItemShelving.vue @@ -45,13 +45,9 @@ const arrayData = useArrayData('ItemShelvings', { const rows = computed(() => arrayData.store.data || []); const applyColumnFilter = async (col) => { - try { - const paramKey = col.columnFilter?.filterParamKey || col.field; - params[paramKey] = col.columnFilter.filterValue; - await arrayData.addFilter({ filter: null, params }); - } catch (err) { - console.error('Error applying column filter', err); - } + const paramKey = col.columnFilter?.filterParamKey || col.field; + params[paramKey] = col.columnFilter.filterValue; + await arrayData.addFilter({ filter: null, params }); }; const getInputEvents = (col) => { @@ -173,15 +169,11 @@ const totalLabels = computed(() => ); const removeLines = async () => { - try { - const itemShelvingIds = rowsSelected.value.map((row) => row.itemShelvingFk); - await axios.post('ItemShelvings/deleteItemShelvings', { itemShelvingIds }); - rowsSelected.value = []; - notify('shelvings.shelvingsRemoved', 'positive'); - await arrayData.fetch({ append: false }); - } catch (err) { - console.error('Error removing lines', err); - } + const itemShelvingIds = rowsSelected.value.map((row) => row.itemShelvingFk); + await axios.post('ItemShelvings/deleteItemShelvings', { itemShelvingIds }); + rowsSelected.value = []; + notify('shelvings.shelvingsRemoved', 'positive'); + await arrayData.fetch({ append: false }); }; onMounted(async () => { await arrayData.fetch({ append: false }); diff --git a/src/pages/Item/Card/ItemTags.vue b/src/pages/Item/Card/ItemTags.vue index 6f31d0cf8..bf6232920 100644 --- a/src/pages/Item/Card/ItemTags.vue +++ b/src/pages/Item/Card/ItemTags.vue @@ -19,22 +19,18 @@ const tagOptions = ref([]); const valueOptionsMap = ref(new Map()); const getSelectedTagValues = async (tag) => { - try { - if (!tag.tagFk && tag.tag.isFree) return; - const filter = { - fields: ['value'], - order: 'value ASC', - limit: 30, - }; + if (!tag.tagFk && tag.tag.isFree) return; + const filter = { + fields: ['value'], + order: 'value ASC', + limit: 30, + }; - const params = { filter: JSON.stringify(filter) }; - const { data } = await axios.get(`Tags/${tag.tagFk}/filterValue`, { - params, - }); - valueOptionsMap.value.set(tag.tagFk, data); - } catch (err) { - console.error('Error getting selected tag values'); - } + const params = { filter: JSON.stringify(filter) }; + const { data } = await axios.get(`Tags/${tag.tagFk}/filterValue`, { + params, + }); + valueOptionsMap.value.set(tag.tagFk, data); }; const onItemTagsFetched = async (itemTags) => { diff --git a/src/pages/Item/Card/ItemTax.vue b/src/pages/Item/Card/ItemTax.vue index 489a2c7b2..44e0b39cd 100644 --- a/src/pages/Item/Card/ItemTax.vue +++ b/src/pages/Item/Card/ItemTax.vue @@ -32,17 +32,13 @@ const ItemTaxRef = ref(null); const taxesOptions = ref([]); const submitTaxes = async (data) => { - try { - let payload = data.map((tax) => ({ - id: tax.id, - taxClassFk: tax.taxClassFk, - })); + let payload = data.map((tax) => ({ + id: tax.id, + taxClassFk: tax.taxClassFk, + })); - await axios.post(`Items/updateTaxes`, payload); - notify(t('globals.dataSaved'), 'positive'); - } catch (err) { - console.error('Error saving taxes', err); - } + await axios.post(`Items/updateTaxes`, payload); + notify(t('globals.dataSaved'), 'positive'); };