import {Action, ThunkAction} from '@reduxjs/toolkit'; import {getNotificationsData} from '../../services'; import {userNotificationsFetched} from '../reducers'; import {RootState} from '../rootReducer'; export const loadUserNotifications = (): ThunkAction, RootState, unknown, Action> => async (dispatch) => { try { const notifications = await getNotificationsData(); dispatch({ type: userNotificationsFetched.type, payload: notifications, }); } catch (error) { console.log(error); } };