Add notification message when delete the default register role

Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
soupette 2020-12-24 10:59:01 +01:00 committed by Convly
parent 61ed2ca7f1
commit 1f2e5c23c0

View File

@ -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();
}