Merge pull request #1283 from mslourens/bugs/1240-new-user-creation

1240 - restore notification blocknotifications method, since it was c…
This commit is contained in:
Martin McKeaveney 2021-03-15 12:08:00 +00:00 committed by GitHub
commit c4b828416a
1 changed files with 10 additions and 0 deletions

View File

@ -13,8 +13,17 @@ const createNotificationStore = () => {
_notifications.set([]) _notifications.set([])
} }
}) })
let block = false
const blockNotifications = (timeout = 1000) => {
block = true
setTimeout(() => (block = false), timeout)
}
const send = (message, type = "default") => { const send = (message, type = "default") => {
if (block) {
return
}
let _id = id() let _id = id()
_notifications.update(state => { _notifications.update(state => {
return [...state, { id: _id, type, message }] return [...state, { id: _id, type, message }]
@ -36,6 +45,7 @@ const createNotificationStore = () => {
warning: msg => send(msg, "warning"), warning: msg => send(msg, "warning"),
info: msg => send(msg, "info"), info: msg => send(msg, "info"),
success: msg => send(msg, "success"), success: msg => send(msg, "success"),
blockNotifications,
} }
} }