mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
refactor: simplify notifications update
This commit is contained in:
1 parent
d3f4cb2dea
commit
e2d2c43a82
1 file changed
+1
-5
@@ -33,11 +33,7 @@ export const addNotification = (notification: Omit<Notification, 'id'>) => {
|
||||
|
||||
const n = { ...defaults, ...notification };
|
||||
notifications.update((all) => {
|
||||
if (all.length < 3) {
|
||||
return [n, ...all];
|
||||
} else {
|
||||
return [n, ...all.slice(0, 2)];
|
||||
}
|
||||
return [n, ...all.slice(0, 2)];
|
||||
});
|
||||
|
||||
if (n.timeout) setTimeout(() => dismissNotification(n.id), n.timeout);
|
||||
|
||||
Reference in new issue
Block a user