fix: refs #6346 fix list and create #404
|
@ -42,9 +42,7 @@ async function getTrays() {
|
|||
const { data } = await axios.get('WagonTypeTrays', undefined, {
|
||||
|
||||
filter: { wagonTypeFk: entityId.value },
|
||||
});
|
||||
existingTrayHeight.value = data.data.filter(
|
||||
(item) => item.wagonTypeFk == entityId.value
|
||||
);
|
||||
existingTrayHeight.value = data.filter((item) => item.wagonTypeFk == entityId.value);
|
||||
heights.value = existingTrayHeight.value.map((item) => item.height);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,36 +32,24 @@ async function loadTrays() {
|
|||
}
|
||||
|
||||
async function addTray(newTray) {
|
||||
try {
|
||||
const res = await axios.post(`WagonTypeTrays`, newTray);
|
||||
wagonTrays.value.push(res.data);
|
||||
notify({
|
||||
message: t(`Tray added successfully`),
|
||||
type: 'positive',
|
||||
});
|
||||
} catch (err) {
|
||||
console.log('err: ', err);
|
||||
}
|
||||
const res = await axios.post(`WagonTypeTrays`, newTray);
|
||||
wagonTrays.value.push(res.data);
|
||||
notify({
|
||||
message: t(`Tray added successfully`),
|
||||
type: 'positive',
|
||||
});
|
||||
}
|
||||
|
||||
async function deleteTray(trayToDelete) {
|
||||
alexm
commented
Si falla el usuari no se entera? Si falla el usuari no se entera?
|
||||
try {
|
||||
await axios.delete(`WagonTypeTrays/${trayToDelete.id}`);
|
||||
const index = wagonTrays.value.findIndex((tray) => tray.id === trayToDelete.id);
|
||||
if (index !== -1) {
|
||||
wagonTrays.value.splice(index, 1);
|
||||
}
|
||||
notify({
|
||||
message: t('Tray deleted successfully'),
|
||||
type: 'positive',
|
||||
});
|
||||
} catch (err) {
|
||||
notify({
|
||||
message: t('Error deleting tray'),
|
||||
type: 'negative',
|
||||
});
|
||||
console.log('err: ', err);
|
||||
await axios.delete(`WagonTypeTrays/${trayToDelete.id}`);
|
||||
const index = wagonTrays.value.findIndex((tray) => tray.id === trayToDelete.id);
|
||||
if (index !== -1) {
|
||||
wagonTrays.value.splice(index, 1);
|
||||
}
|
||||
notify({
|
||||
message: t('Tray deleted successfully'),
|
||||
type: 'positive',
|
||||
});
|
||||
}
|
||||
|
||||
const filter = {
|
||||
|
|
Loading…
Reference in New Issue
const {data} =