From 1f2e5c23c0c92217e95828a3e1f7fc26a75d870c Mon Sep 17 00:00:00 2001 From: soupette Date: Thu, 24 Dec 2020 10:59:01 +0100 Subject: [PATCH] Add notification message when delete the default register role Signed-off-by: soupette --- .../admin/containers/Roles/ListPage/index.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/strapi-admin/ee/admin/containers/Roles/ListPage/index.js b/packages/strapi-admin/ee/admin/containers/Roles/ListPage/index.js index 73e1b373b8..2ad6ba1cf6 100644 --- a/packages/strapi-admin/ee/admin/containers/Roles/ListPage/index.js +++ b/packages/strapi-admin/ee/admin/containers/Roles/ListPage/index.js @@ -4,6 +4,7 @@ import { Button } from '@buffetjs/core'; import { List, Header } from '@buffetjs/custom'; import { Plus } from '@buffetjs/icons'; import matchSorter from 'match-sorter'; +import { get } from 'lodash'; import { useGlobalContext, useQuery, @@ -108,11 +109,20 @@ const RoleListPage = () => { } } catch (err) { console.error(err); + const errorIds = get(err, ['response', 'payload', 'data', 'ids'], null); - strapi.notification.toggle({ - type: 'warning', - message: { id: 'notification.error' }, - }); + if (errorIds && Array.isArray(errorIds)) { + const errorsMsg = errorIds.join('\n'); + strapi.notification.toggle({ + type: 'warning', + message: errorsMsg, + }); + } else { + strapi.notification.toggle({ + type: 'warning', + message: { id: 'notification.error' }, + }); + } } finally { handleToggleModal(); }