From 2584a8eb49e308e2dcdcb0ee33abf13a51367dd0 Mon Sep 17 00:00:00 2001 From: alexeyzvegintcev Date: Tue, 30 Nov 2021 01:06:47 +0200 Subject: [PATCH] Changed resp format for actions (#637) --- src/ng/gridz/list/BaseListCtrl.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ng/gridz/list/BaseListCtrl.js b/src/ng/gridz/list/BaseListCtrl.js index b8e33a328..5947ffce5 100644 --- a/src/ng/gridz/list/BaseListCtrl.js +++ b/src/ng/gridz/list/BaseListCtrl.js @@ -244,7 +244,8 @@ export default class BaseListCtrl { handleError(er) { console.error(er) - toast.error(er) + const message = er?.response?.status === 500 ? 'Unexpected error' : null + toast.error(message || er) } swalError(error) { @@ -276,10 +277,10 @@ export default class BaseListCtrl { try { const result = await action() if(result.ok){ - toast.success(result.success[0]?.message || 'Action is sucsess') + toast.success(result.title || 'Action is sucsess') this.gridCtrl.reload() // todo: should we reload only selected rows? } else { - this.swalError({title: 'Action Error',message: result.failed[0]?.message || 'Action failed'}) + this.swalError({title: result.title , message: result?.failed?.join('
') || ''}) } } catch (e) { this.handleError(e)