mirror of
https://github.com/glitch-soc/mastodon.git
synced 2024-11-29 19:40:23 -05:00
19 lines
636 B
TypeScript
19 lines
636 B
TypeScript
|
import { createAppAsyncThunk } from 'mastodon/store';
|
||
|
|
||
|
import { fetchNotifications } from './notification_groups';
|
||
|
import { expandNotifications } from './notifications';
|
||
|
|
||
|
export const initializeNotifications = createAppAsyncThunk(
|
||
|
'notifications/initialize',
|
||
|
(_, { dispatch, getState }) => {
|
||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
||
|
const enableBeta = getState().settings.getIn(
|
||
|
['notifications', 'groupingBeta'],
|
||
|
false,
|
||
|
) as boolean;
|
||
|
|
||
|
if (enableBeta) void dispatch(fetchNotifications());
|
||
|
else dispatch(expandNotifications());
|
||
|
},
|
||
|
);
|