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