github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/webapp/javascript/redux/reducers/notifications.ts (about) 1 /* eslint-disable import/prefer-default-export */ 2 import { store } from '@webapp/ui/Notifications'; 3 import type { NotificationOptions } from '@webapp/ui/Notifications'; 4 import { createAsyncThunk } from '../async-thunk'; 5 6 export const addNotification = createAsyncThunk( 7 'notifications/add', 8 async (opts: NotificationOptions) => { 9 return new Promise((resolve) => { 10 // TODO: 11 // we can at some point add default buttons OK and Cancel 12 // which would resolve/reject the promise 13 store.addNotification({ 14 ...opts, 15 onRemoval: () => { 16 // TODO: fix type 17 resolve(null as ShamefulAny); 18 }, 19 }); 20 }); 21 } 22 ); 23 24 // TODO 25 // create a store with maintains the notification history?