0
0
Fork 0
This commit is contained in:
Alex Moreno 2024-11-22 11:21:33 +01:00
commit 142302193e
1 changed files with 27 additions and 19 deletions

View File

@ -57,6 +57,7 @@ async function getConfig(url, filter) {
} }
async function fetchViewConfigData() { async function fetchViewConfigData() {
try {
const defaultFilter = { const defaultFilter = {
where: { tableCode: $props.tableCode }, where: { tableCode: $props.tableCode },
}; };
@ -79,6 +80,9 @@ async function fetchViewConfigData() {
setUserConfigViewData(defaultConfig.columns); setUserConfigViewData(defaultConfig.columns);
return; return;
} }
} catch (err) {
console.error('Error fetching config view data', err);
}
} }
async function saveConfig() { async function saveConfig() {
@ -88,6 +92,7 @@ async function saveConfig() {
setUserConfigViewData(configuration, true); setUserConfigViewData(configuration, true);
if (!$props.tableCode) return popupProxyRef.value.hide(); if (!$props.tableCode) return popupProxyRef.value.hide();
try {
const params = {}; const params = {};
// Si existe una view config del usuario hacemos un update si no la creamos // Si existe una view config del usuario hacemos un update si no la creamos
if (initialUserConfigViewData.value) { if (initialUserConfigViewData.value) {
@ -118,7 +123,10 @@ async function saveConfig() {
} }
notify('globals.dataSaved', 'positive'); notify('globals.dataSaved', 'positive');
popupProxyRef.value.hide(); popupProxyRef.value.hide();
} catch (err) {
console.error('Error saving user view config', err);
notify('errors.writeRequest', 'negative');
}
} }
onMounted(async () => { onMounted(async () => {