diff --git a/packages/pl-fe/src/actions/about.ts b/packages/pl-fe/src/actions/about.ts index 6737b4508..ceb17ad29 100644 --- a/packages/pl-fe/src/actions/about.ts +++ b/packages/pl-fe/src/actions/about.ts @@ -6,6 +6,26 @@ const FETCH_ABOUT_PAGE_REQUEST = 'FETCH_ABOUT_PAGE_REQUEST' as const; const FETCH_ABOUT_PAGE_SUCCESS = 'FETCH_ABOUT_PAGE_SUCCESS' as const; const FETCH_ABOUT_PAGE_FAIL = 'FETCH_ABOUT_PAGE_FAIL' as const; +interface FetchAboutPageRequestAction { + type: typeof FETCH_ABOUT_PAGE_REQUEST; + slug: string; + locale?: string; +} + +interface FetchAboutPageSuccessAction { + type: typeof FETCH_ABOUT_PAGE_SUCCESS; + slug: string; + locale?: string; + html: string; +} + +interface FetchAboutPageFailAction { + type: typeof FETCH_ABOUT_PAGE_FAIL; + slug: string; + locale?: string; + error: any; +} + const fetchAboutPage = (slug = 'index', locale?: string) => (dispatch: AppDispatch, getState: () => RootState) => { dispatch({ type: FETCH_ABOUT_PAGE_REQUEST, slug, locale }); @@ -21,9 +41,15 @@ const fetchAboutPage = (slug = 'index', locale?: string) => (dispatch: AppDispat }); }; +type AboutAction = + | FetchAboutPageRequestAction + | FetchAboutPageSuccessAction + | FetchAboutPageFailAction; + export { fetchAboutPage, FETCH_ABOUT_PAGE_REQUEST, FETCH_ABOUT_PAGE_SUCCESS, FETCH_ABOUT_PAGE_FAIL, + type AboutAction, }; diff --git a/packages/pl-fe/src/actions/auth.ts b/packages/pl-fe/src/actions/auth.ts index b19b4f400..52c9e5713 100644 --- a/packages/pl-fe/src/actions/auth.ts +++ b/packages/pl-fe/src/actions/auth.ts @@ -57,69 +57,6 @@ const AUTH_ACCOUNT_REMEMBER_REQUEST = 'AUTH_ACCOUNT_REMEMBER_REQUEST' as const; const AUTH_ACCOUNT_REMEMBER_SUCCESS = 'AUTH_ACCOUNT_REMEMBER_SUCCESS' as const; const AUTH_ACCOUNT_REMEMBER_FAIL = 'AUTH_ACCOUNT_REMEMBER_FAIL' as const; -interface SwitchAccountAction { - type: typeof SWITCH_ACCOUNT; - account?: Account; - background: boolean; -} - -interface AuthAppCreatedAction { - type: typeof AUTH_APP_CREATED; - app: Application; -} - -interface AuthAppAuthorizedAction { - type: typeof AUTH_APP_AUTHORIZED; - app: Application; - token: Token; -} - -interface AuthLoggedInAction { - type: typeof AUTH_LOGGED_IN; - token: Token; -} - -interface AuthLoggedOutAction { - type: typeof AUTH_LOGGED_OUT; - account: Account; - standalone: boolean; -} - -interface VerifyCredentialsRequestAction { - type: typeof VERIFY_CREDENTIALS_REQUEST; - token: string; -} - -interface VerifyCredentialsSuccessAction { - type: typeof VERIFY_CREDENTIALS_SUCCESS; - token: string; - account: CredentialAccount; -} - -interface VerifyCredentialsFailAction { - type: typeof VERIFY_CREDENTIALS_FAIL; - token: string; - error: any; -} - -interface AuthAccountRememberRequestAction { - type: typeof AUTH_ACCOUNT_REMEMBER_REQUEST; - accountUrl: string; -} - -interface AuthAccountRememberSuccessAction { - type: typeof AUTH_ACCOUNT_REMEMBER_SUCCESS; - accountUrl: string; - account: CredentialAccount; -} - -interface AuthAccountRememberFailAction { - type: typeof AUTH_ACCOUNT_REMEMBER_FAIL; - error: any; - accountUrl: string; - skipAlert: boolean; -} - const customApp = custom('app'); const messages = defineMessages({ @@ -136,6 +73,11 @@ const createAppAndToken = () => dispatch(createAppToken()), ); +interface AuthAppCreatedAction { + type: typeof AUTH_APP_CREATED; + app: Application; +} + /** Create an auth app, or use it from build config */ const getAuthApp = () => (dispatch: AppDispatch) => { @@ -160,6 +102,12 @@ const createAuthApp = () => ); }; +interface AuthAppAuthorizedAction { + type: typeof AUTH_APP_AUTHORIZED; + app: Application; + token: Token; +} + const createAppToken = () => (dispatch: AppDispatch, getState: () => RootState) => { const app = getState().auth.app!; @@ -212,6 +160,23 @@ const otpVerify = (code: string, mfa_token: string) => }).then((token) => dispatch(authLoggedIn(token))); }; +interface VerifyCredentialsRequestAction { + type: typeof VERIFY_CREDENTIALS_REQUEST; + token: string; +} + +interface VerifyCredentialsSuccessAction { + type: typeof VERIFY_CREDENTIALS_SUCCESS; + token: string; + account: CredentialAccount; +} + +interface VerifyCredentialsFailAction { + type: typeof VERIFY_CREDENTIALS_FAIL; + token: string; + error: any; +} + const verifyCredentials = (token: string, accountUrl?: string) => (dispatch: AppDispatch, getState: () => RootState) => { const baseURL = parseBaseURL(accountUrl) || BuildConfig.BACKEND_URL; @@ -242,6 +207,24 @@ const verifyCredentials = (token: string, accountUrl?: string) => }); }; +interface AuthAccountRememberRequestAction { + type: typeof AUTH_ACCOUNT_REMEMBER_REQUEST; + accountUrl: string; +} + +interface AuthAccountRememberSuccessAction { + type: typeof AUTH_ACCOUNT_REMEMBER_SUCCESS; + accountUrl: string; + account: CredentialAccount; +} + +interface AuthAccountRememberFailAction { + type: typeof AUTH_ACCOUNT_REMEMBER_FAIL; + error: any; + accountUrl: string; + skipAlert: boolean; +} + const rememberAuthAccount = (accountUrl: string) => (dispatch: AppDispatch, getState: () => RootState) => { dispatch({ type: AUTH_ACCOUNT_REMEMBER_REQUEST, accountUrl }); @@ -275,6 +258,12 @@ const logIn = (username: string, password: string) => throw error; }); +interface AuthLoggedOutAction { + type: typeof AUTH_LOGGED_OUT; + account: Account; + standalone: boolean; +} + const logOut = () => (dispatch: AppDispatch, getState: () => RootState) => { const state = getState(); @@ -304,6 +293,12 @@ const logOut = () => }); }; +interface SwitchAccountAction { + type: typeof SWITCH_ACCOUNT; + account?: Account; + background: boolean; +} + const switchAccount = (accountId: string, background = false) => (dispatch: AppDispatch, getState: () => RootState) => { const account = selectAccount(getState(), accountId); @@ -341,6 +336,11 @@ const register = (params: CreateAccountParams) => const fetchCaptcha = () => (_dispatch: AppDispatch, getState: () => RootState) => getClient(getState).oauth.getCaptcha(); +interface AuthLoggedInAction { + type: typeof AUTH_LOGGED_IN; + token: Token; +} + const authLoggedIn = (token: Token) => (dispatch: AppDispatch) => { dispatch({ type: AUTH_LOGGED_IN, token }); diff --git a/packages/pl-fe/src/actions/compose.ts b/packages/pl-fe/src/actions/compose.ts index 8e766170e..01b60e13e 100644 --- a/packages/pl-fe/src/actions/compose.ts +++ b/packages/pl-fe/src/actions/compose.ts @@ -137,7 +137,7 @@ const setComposeToStatus = ( const client = getClient(getState); const { createStatusExplicitAddressing: explicitAddressing, version: v } = client.features; - const action: ComposeSetStatusAction = { + dispatch({ type: COMPOSE_SET_STATUS, composeId: 'compose-modal', status, @@ -150,9 +150,7 @@ const setComposeToStatus = ( withRedraft, draftId, editorState, - }; - - dispatch(action); + }); }; const changeCompose = (composeId: string, text: string) => ({ @@ -184,7 +182,7 @@ const replyCompose = ( if (!account) return; - const action: ComposeReplyAction = { + dispatch({ type: COMPOSE_REPLY, composeId: 'compose-modal', status, @@ -192,9 +190,7 @@ const replyCompose = ( explicitAddressing, preserveSpoilers, rebloggedBy, - }; - - dispatch(action); + }); useModalsStore.getState().openModal('COMPOSE'); }; @@ -216,15 +212,13 @@ const quoteCompose = (status: ComposeQuoteAction['status']) => const state = getState(); const { createStatusExplicitAddressing: explicitAddressing } = state.auth.client.features; - const action: ComposeQuoteAction = { + dispatch({ type: COMPOSE_QUOTE, composeId: 'compose-modal', status, account: selectOwnAccount(state), explicitAddressing, - }; - - dispatch(action); + }); useModalsStore.getState().openModal('COMPOSE'); }; @@ -256,13 +250,11 @@ const mentionCompose = (account: ComposeMentionAction['account']) => (dispatch: AppDispatch, getState: () => RootState) => { if (!getState().me) return; - const action: ComposeMentionAction = { + dispatch({ type: COMPOSE_MENTION, composeId: 'compose-modal', account: account, - }; - - dispatch(action); + }); useModalsStore.getState().openModal('COMPOSE'); }; @@ -274,13 +266,11 @@ interface ComposeDirectAction { const directCompose = (account: ComposeDirectAction['account']) => (dispatch: AppDispatch) => { - const action: ComposeDirectAction = { + dispatch({ type: COMPOSE_DIRECT, composeId: 'compose-modal', account, - }; - - dispatch(action); + }); useModalsStore.getState().openModal('COMPOSE'); }; @@ -289,13 +279,11 @@ const directComposeById = (accountId: string) => const account = selectAccount(getState(), accountId); if (!account) return; - const action: ComposeDirectAction = { + dispatch({ type: COMPOSE_DIRECT, composeId: 'compose-modal', account, - }; - - dispatch(action); + }); useModalsStore.getState().openModal('COMPOSE'); }; @@ -701,16 +689,14 @@ const selectComposeSuggestion = (composeId: string, position: number, token: str startPosition = position; } - const action: ComposeSuggestionSelectAction = { + dispatch({ type: COMPOSE_SUGGESTION_SELECT, composeId, position: startPosition, token, completion, path, - }; - - dispatch(action); + }); }; const updateSuggestionTags = (composeId: string, token: string, tags: Array) => ({ @@ -870,13 +856,11 @@ const addToMentions = (composeId: string, accountId: string) => const account = selectAccount(state, accountId); if (!account) return; - const action: ComposeAddToMentionsAction = { + return dispatch({ type: COMPOSE_ADD_TO_MENTIONS, composeId, account: account.acct, - }; - - return dispatch(action); + }); }; interface ComposeRemoveFromMentionsAction { @@ -891,13 +875,11 @@ const removeFromMentions = (composeId: string, accountId: string) => const account = selectAccount(state, accountId); if (!account) return; - const action: ComposeRemoveFromMentionsAction = { + return dispatch({ type: COMPOSE_REMOVE_FROM_MENTIONS, composeId, account: account.acct, - }; - - return dispatch(action); + }); }; interface ComposeEventReplyAction { diff --git a/packages/pl-fe/src/actions/instance.ts b/packages/pl-fe/src/actions/instance.ts index 629db73f8..3eb5cbcbb 100644 --- a/packages/pl-fe/src/actions/instance.ts +++ b/packages/pl-fe/src/actions/instance.ts @@ -33,8 +33,7 @@ const fetchInstance = () => async (dispatch: AppDispatch, getState: () => RootSt try { const instance = await getClient(getState).instance.getInstance(); - const action: InstanceFetchSuccessAction = { type: INSTANCE_FETCH_SUCCESS, instance }; - dispatch(action); + dispatch({ type: INSTANCE_FETCH_SUCCESS, instance }); } catch (error) { dispatch({ type: INSTANCE_FETCH_FAIL, error }); } diff --git a/packages/pl-fe/src/actions/status-quotes.ts b/packages/pl-fe/src/actions/status-quotes.ts index f10956691..cdfe8ed6e 100644 --- a/packages/pl-fe/src/actions/status-quotes.ts +++ b/packages/pl-fe/src/actions/status-quotes.ts @@ -39,25 +39,22 @@ const fetchStatusQuotes = (statusId: string) => return dispatch(noOp); } - const action: FetchStatusQuotesRequestAction = { type: STATUS_QUOTES_FETCH_REQUEST, statusId }; - dispatch(action); + dispatch({ type: STATUS_QUOTES_FETCH_REQUEST, statusId }); return getClient(getState).statuses.getStatusQuotes(statusId).then(response => { dispatch(importEntities({ statuses: response.items })); - const action: FetchStatusQuotesSuccessAction = { + return dispatch({ type: STATUS_QUOTES_FETCH_SUCCESS, statusId, statuses: response.items, next: response.next, - }; - return dispatch(action); + }); }).catch(error => { - const action: FetchStatusQuotesFailAction = { + dispatch({ type: STATUS_QUOTES_FETCH_FAIL, statusId, error, - }; - dispatch(action); + }); }); }; @@ -87,28 +84,25 @@ const expandStatusQuotes = (statusId: string) => return dispatch(noOp); } - const action: ExpandStatusQuotesRequestAction = { + dispatch({ type: STATUS_QUOTES_EXPAND_REQUEST, statusId, - }; - dispatch(action); + }); return next().then(response => { dispatch(importEntities({ statuses: response.items })); - const action: ExpandStatusQuotesSuccessAction = { + dispatch({ type: STATUS_QUOTES_EXPAND_SUCCESS, statusId, statuses: response.items, next: response.next, - }; - dispatch(action); + }); }).catch(error => { - const action: ExpandStatusQuotesFailAction = { + dispatch({ type: STATUS_QUOTES_EXPAND_FAIL, statusId, error, - }; - dispatch(action); + }); }); }; diff --git a/packages/pl-fe/src/actions/suggestions.ts b/packages/pl-fe/src/actions/suggestions.ts index 326997169..4d407eeae 100644 --- a/packages/pl-fe/src/actions/suggestions.ts +++ b/packages/pl-fe/src/actions/suggestions.ts @@ -4,12 +4,28 @@ import { fetchRelationships } from './accounts'; import { importEntities } from './importer'; import { insertSuggestionsIntoTimeline } from './timelines'; +import type { Suggestion } from 'pl-api'; import type { AppDispatch, RootState } from 'pl-fe/store'; const SUGGESTIONS_FETCH_REQUEST = 'SUGGESTIONS_FETCH_REQUEST' as const; const SUGGESTIONS_FETCH_SUCCESS = 'SUGGESTIONS_FETCH_SUCCESS' as const; const SUGGESTIONS_FETCH_FAIL = 'SUGGESTIONS_FETCH_FAIL' as const; +interface SuggestionsFetchRequestAction { + type: typeof SUGGESTIONS_FETCH_REQUEST; +} + +interface SuggestionsFetchSuccessAction { + type: typeof SUGGESTIONS_FETCH_SUCCESS; + suggestions: Array; +} + +interface SuggestionsFetchFailAction { + type: typeof SUGGESTIONS_FETCH_FAIL; + error: any; + skipAlert: true; +} + const fetchSuggestions = (limit = 50) => (dispatch: AppDispatch, getState: () => RootState) => { const state = getState(); @@ -19,18 +35,18 @@ const fetchSuggestions = (limit = 50) => if (!me) return null; if (client.features.suggestions) { - dispatch({ type: SUGGESTIONS_FETCH_REQUEST }); + dispatch({ type: SUGGESTIONS_FETCH_REQUEST }); return getClient(getState).myAccount.getSuggestions(limit).then((suggestions) => { const accounts = suggestions.map(({ account }) => account); dispatch(importEntities({ accounts })); - dispatch({ type: SUGGESTIONS_FETCH_SUCCESS, suggestions }); + dispatch({ type: SUGGESTIONS_FETCH_SUCCESS, suggestions }); dispatch(fetchRelationships(accounts.map(({ id }) => id))); return suggestions; }).catch(error => { - dispatch({ type: SUGGESTIONS_FETCH_FAIL, error, skipAlert: true }); + dispatch({ type: SUGGESTIONS_FETCH_FAIL, error, skipAlert: true }); throw error; }); } else { @@ -43,10 +59,16 @@ const fetchSuggestionsForTimeline = () => (dispatch: AppDispatch) => { dispatch(fetchSuggestions(20))?.then(() => dispatch(insertSuggestionsIntoTimeline())); }; +type SuggestionsAction = + | SuggestionsFetchRequestAction + | SuggestionsFetchSuccessAction + | SuggestionsFetchFailAction; + export { SUGGESTIONS_FETCH_REQUEST, SUGGESTIONS_FETCH_SUCCESS, SUGGESTIONS_FETCH_FAIL, fetchSuggestions, fetchSuggestionsForTimeline, + type SuggestionsAction, }; diff --git a/packages/pl-fe/src/actions/tags.ts b/packages/pl-fe/src/actions/tags.ts index bb7c6a3b6..f3add63e7 100644 --- a/packages/pl-fe/src/actions/tags.ts +++ b/packages/pl-fe/src/actions/tags.ts @@ -156,6 +156,23 @@ const expandFollowedHashtagsFail = (error: unknown) => ({ error, }); +type TagsAction = + | ReturnType + | ReturnType + | ReturnType + | ReturnType + | ReturnType + | ReturnType + | ReturnType + | ReturnType + | ReturnType + | ReturnType + | ReturnType + | ReturnType + | ReturnType + | ReturnType + | ReturnType; + export { HASHTAG_FETCH_REQUEST, HASHTAG_FETCH_SUCCESS, @@ -192,4 +209,5 @@ export { expandFollowedHashtagsRequest, expandFollowedHashtagsSuccess, expandFollowedHashtagsFail, + type TagsAction, }; diff --git a/packages/pl-fe/src/actions/timelines.ts b/packages/pl-fe/src/actions/timelines.ts index d3767ea47..0b2a3a84f 100644 --- a/packages/pl-fe/src/actions/timelines.ts +++ b/packages/pl-fe/src/actions/timelines.ts @@ -61,18 +61,19 @@ const updateTimeline = (timeline: string, statusId: string) => ({ statusId, }); -const updateTimelineQueue = (timeline: string, statusId: string) => - (dispatch: AppDispatch) => { - // if (typeof accept === 'function' && !accept(status)) { - // return; - // } +const updateTimelineQueue = (timeline: string, statusId: string) => ({ +// if (typeof accept === 'function' && !accept(status)) { +// return; +// } + type: TIMELINE_UPDATE_QUEUE, + timeline, + statusId, +}); - dispatch({ - type: TIMELINE_UPDATE_QUEUE, - timeline, - statusId, - }); - }; +interface TimelineDequeueAction { + type: typeof TIMELINE_DEQUEUE; + timeline: string; +} const dequeueTimeline = (timelineId: string, expandFunc?: (lastStatusId: string) => void) => (dispatch: AppDispatch, getState: () => RootState) => { @@ -82,7 +83,7 @@ const dequeueTimeline = (timelineId: string, expandFunc?: (lastStatusId: string) if (queuedCount <= 0) return; if (queuedCount <= MAX_QUEUED_ITEMS) { - dispatch({ type: TIMELINE_DEQUEUE, timeline: timelineId }); + dispatch({ type: TIMELINE_DEQUEUE, timeline: timelineId }); return; } @@ -115,15 +116,13 @@ const deleteFromTimelines = (statusId: string) => const references = getState().statuses.filter(status => status.reblog_id === statusId).map(status => [status.id, status.account_id] as const); const reblogOf = getState().statuses.get(statusId)?.reblog_id || null; - const action: TimelineDeleteAction = { + dispatch({ type: TIMELINE_DELETE, statusId, accountId, references, reblogOf, - }; - - dispatch(action); + }); }; const clearTimeline = (timeline: string) => ({ type: TIMELINE_CLEAR, timeline }); @@ -324,12 +323,20 @@ const scrollTopTimeline = (timeline: string, top: boolean) => ({ top, }); -const insertSuggestionsIntoTimeline = () => (dispatch: AppDispatch, getState: () => RootState) => { - dispatch({ type: TIMELINE_INSERT, timeline: 'home' }); -}; +const insertSuggestionsIntoTimeline = () => ({ type: TIMELINE_INSERT, timeline: 'home' }); // TODO: other actions -type TimelineAction = TimelineDeleteAction; +type TimelineAction = + | ReturnType + | TimelineDeleteAction + | ReturnType + | ReturnType + | TimelineDequeueAction + | ReturnType + | ReturnType + | ReturnType + | ReturnType + | ReturnType; export { TIMELINE_UPDATE, diff --git a/packages/pl-fe/src/actions/trending-statuses.ts b/packages/pl-fe/src/actions/trending-statuses.ts index 008e5b47f..2d7222d62 100644 --- a/packages/pl-fe/src/actions/trending-statuses.ts +++ b/packages/pl-fe/src/actions/trending-statuses.ts @@ -2,12 +2,27 @@ import { getClient } from '../api'; import { importEntities } from './importer'; +import type { Status } from 'pl-api'; import type { AppDispatch, RootState } from 'pl-fe/store'; const TRENDING_STATUSES_FETCH_REQUEST = 'TRENDING_STATUSES_FETCH_REQUEST' as const; const TRENDING_STATUSES_FETCH_SUCCESS = 'TRENDING_STATUSES_FETCH_SUCCESS' as const; const TRENDING_STATUSES_FETCH_FAIL = 'TRENDING_STATUSES_FETCH_FAIL' as const; +interface TrendingStatusesFetchRequestAction { + type: typeof TRENDING_STATUSES_FETCH_REQUEST; +} + +interface TrendingStatusesFetchSuccessAction { + type: typeof TRENDING_STATUSES_FETCH_SUCCESS; + statuses: Array; +} + +interface TrendingStatusesFetchFailAction { + type: typeof TRENDING_STATUSES_FETCH_FAIL; + error: any; +} + const fetchTrendingStatuses = () => (dispatch: AppDispatch, getState: () => RootState) => { const state = getState(); @@ -15,20 +30,26 @@ const fetchTrendingStatuses = () => if (!client.features.trendingStatuses) return; - dispatch({ type: TRENDING_STATUSES_FETCH_REQUEST }); + dispatch({ type: TRENDING_STATUSES_FETCH_REQUEST }); return client.trends.getTrendingStatuses().then((statuses) => { dispatch(importEntities({ statuses })); - dispatch({ type: TRENDING_STATUSES_FETCH_SUCCESS, statuses }); + dispatch({ type: TRENDING_STATUSES_FETCH_SUCCESS, statuses }); return statuses; }).catch(error => { - dispatch({ type: TRENDING_STATUSES_FETCH_FAIL, error }); + dispatch({ type: TRENDING_STATUSES_FETCH_FAIL, error }); }); }; +type TrendingStatusesAction = + | TrendingStatusesFetchRequestAction + | TrendingStatusesFetchSuccessAction + | TrendingStatusesFetchFailAction; + export { TRENDING_STATUSES_FETCH_REQUEST, TRENDING_STATUSES_FETCH_SUCCESS, TRENDING_STATUSES_FETCH_FAIL, fetchTrendingStatuses, + type TrendingStatusesAction, }; diff --git a/packages/pl-fe/src/reducers/compose.ts b/packages/pl-fe/src/reducers/compose.ts index 7cc576fc9..928a22086 100644 --- a/packages/pl-fe/src/reducers/compose.ts +++ b/packages/pl-fe/src/reducers/compose.ts @@ -64,7 +64,7 @@ import { import { EVENT_COMPOSE_CANCEL, EVENT_FORM_SET, type EventsAction } from '../actions/events'; import { ME_FETCH_SUCCESS, ME_PATCH_SUCCESS, MeAction } from '../actions/me'; import { FE_NAME } from '../actions/settings'; -import { TIMELINE_DELETE, TimelineAction } from '../actions/timelines'; +import { TIMELINE_DELETE, type TimelineAction } from '../actions/timelines'; import { unescapeHTML } from '../utils/html'; import type { Emoji } from 'pl-fe/features/emoji'; diff --git a/packages/pl-fe/src/reducers/suggestions.ts b/packages/pl-fe/src/reducers/suggestions.ts index e829dead5..991dd31c8 100644 --- a/packages/pl-fe/src/reducers/suggestions.ts +++ b/packages/pl-fe/src/reducers/suggestions.ts @@ -6,6 +6,7 @@ import { SUGGESTIONS_FETCH_REQUEST, SUGGESTIONS_FETCH_SUCCESS, SUGGESTIONS_FETCH_FAIL, + type SuggestionsAction, } from 'pl-fe/actions/suggestions'; import type { Suggestion as SuggestionEntity } from 'pl-api'; @@ -37,7 +38,7 @@ const dismissAccount = (state: State, accountId: string) => const dismissAccounts = (state: State, accountIds: string[]) => state.update('items', items => items.filter(item => !accountIds.includes(item.account_id))); -const suggestionsReducer = (state: State = ReducerRecord(), action: AnyAction | DomainBlocksAction) => { +const suggestionsReducer = (state: State = ReducerRecord(), action: AnyAction | DomainBlocksAction | SuggestionsAction) => { switch (action.type) { case SUGGESTIONS_FETCH_REQUEST: return state.set('isLoading', true);