Skip to content

Commit 713ff78

Browse files
committed
Avoid more information link on every notification
1 parent 3d8aa2a commit 713ff78

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

admin/src/components/Collections.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const Collections = ({ updateCredentials }) => {
6161
if (update.error) {
6262
errorNotifications(update)
6363
} else {
64-
successNotification({ message: `${collection} is created!`, duration: 4000, link: '#' })
64+
successNotification({ message: `${collection} is created!`, duration: 4000 })
6565
setCollectionsList(prev => prev.map(col => {
6666
if (col.name === collection) col.status = 'enqueued'
6767
return col
@@ -95,7 +95,7 @@ const Collections = ({ updateCredentials }) => {
9595
method: 'DELETE'
9696
})
9797
if (res.error) errorNotifications(res)
98-
else successNotification({ message: `${collection} collection is removed from MeiliSearch!`, link: '#', duration: 4000 })
98+
else successNotification({ message: `${collection} collection is removed from MeiliSearch!`, duration: 4000 })
9999
}
100100

101101
const addOrRemoveCollection = async (row) => {

admin/src/utils/notifications.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
export function errorNotifications ({ message, link, duration = 4000 }) {
1+
export function errorNotifications ({ message, link }) {
22
strapi.notification.toggle({
33
title: 'Operation on MeiliSearch failed',
44
type: 'warning',
55
message: message,
6-
...(link ? { link: { url: link, label: 'more information' } } : {}),
7-
timeout: duration
6+
...(link && { link: { url: link, label: 'learn more' } }),
7+
blockTransition: true // The user has to close the error notification manually
88
})
99
}
1010

1111
export function successNotification ({ message, duration = 4000, link }) {
1212
strapi.notification.toggle({
1313
type: 'success',
1414
message: message,
15-
...(link ? { link: { url: link, label: 'more information' } } : {}),
15+
...(link && { link: { url: link, label: 'learn more' } }),
1616
timeout: duration
1717
})
1818
}

0 commit comments

Comments
 (0)