fix adapting of legacy notification to the new toast system

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9415
GitOrigin-RevId: bfc3d9f18a459e74b9f2b37dac6c4858c26acefa
This commit is contained in:
Luca Restagno 2023-06-07 18:21:20 +02:00 committed by hasura-bot
parent 092be72ac1
commit 0407229c83

View File

@ -58,6 +58,13 @@ export const showNotification = (
toast.remove();
}
if (options?.action && options?.action?.callback) {
toastProps.button = {
label: options.action.label,
onClick: options.action.callback,
};
}
if (options.alternateActionButtonProps) {
toastProps.button = {
label: options.alternateActionButtonProps.label,
@ -70,13 +77,13 @@ export const showNotification = (
}
}
if (typeof options?.title === 'object' && toastProps?.children) {
if (typeof options?.title === 'object') {
titleAsNode = options.title;
} else if (typeof options?.title === 'string') {
toastProps.title = options.title;
}
if (typeof options?.message === 'object' && toastProps?.children) {
if (typeof options?.message === 'object') {
messageAsNode = options.message;
} else if (typeof options?.message === 'string') {
toastProps.message = options.message;