blob: 88a1cf94e248a8e1135d8a803ba87d97cb7281f7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
import {Action, ThunkAction} from '@reduxjs/toolkit';
import {getNotificationsData} from '../../services';
import {userNotificationsFetched} from '../reducers';
import {RootState} from '../rootReducer';
export const loadUserNotifications =
(): ThunkAction<Promise<void>, RootState, unknown, Action<string>> =>
async (dispatch) => {
try {
const notifications = await getNotificationsData();
dispatch({
type: userNotificationsFetched.type,
payload: notifications,
});
} catch (error) {
console.log(error);
}
};
|