salix-front/src/utils/notifyResults.js

20 lines
672 B
JavaScript

import { Notify } from 'quasar';
export default function (results, key) {
results.forEach((result, index) => {
if (result.status === 'fulfilled') {
const data = JSON.parse(result.value.config.data);
Notify.create({
type: 'positive',
message: `Operación (${index + 1}) ${data[key]} completada con éxito.`,
});
} else {
const data = JSON.parse(result.reason.config.data);
Notify.create({
type: 'negative',
message: `Operación (${index + 1}) ${data[key]} fallida: ${result.reason.message}`,
});
}
});
}