Remove unneeded AxiosError usages

This commit is contained in:
Alex Gleason 2023-10-23 17:22:10 -05:00
parent 8e09eaebc3
commit 86e0245de3
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
34 changed files with 131 additions and 163 deletions

View File

@ -1,6 +1,5 @@
import api from '../api'; import api from '../api';
import type { AxiosError } from 'axios';
import type { AnyAction } from 'redux'; import type { AnyAction } from 'redux';
import type { RootState } from 'soapbox/store'; import type { RootState } from 'soapbox/store';
@ -31,7 +30,7 @@ const submitAccountNoteSuccess = (relationship: any) => ({
relationship, relationship,
}); });
const submitAccountNoteFail = (error: AxiosError) => ({ const submitAccountNoteFail = (error: unknown) => ({
type: ACCOUNT_NOTE_SUBMIT_FAIL, type: ACCOUNT_NOTE_SUBMIT_FAIL,
error, error,
}); });

View File

@ -224,7 +224,7 @@ const fetchAccountSuccess = (account: APIEntity) => ({
account, account,
}); });
const fetchAccountFail = (id: string | null, error: AxiosError) => ({ const fetchAccountFail = (id: string | null, error: unknown) => ({
type: ACCOUNT_FETCH_FAIL, type: ACCOUNT_FETCH_FAIL,
id, id,
error, error,
@ -272,7 +272,7 @@ const blockAccountSuccess = (relationship: APIEntity, statuses: ImmutableMap<str
statuses, statuses,
}); });
const blockAccountFail = (error: AxiosError) => ({ const blockAccountFail = (error: unknown) => ({
type: ACCOUNT_BLOCK_FAIL, type: ACCOUNT_BLOCK_FAIL,
error, error,
}); });
@ -287,7 +287,7 @@ const unblockAccountSuccess = (relationship: APIEntity) => ({
relationship, relationship,
}); });
const unblockAccountFail = (error: AxiosError) => ({ const unblockAccountFail = (error: unknown) => ({
type: ACCOUNT_UNBLOCK_FAIL, type: ACCOUNT_UNBLOCK_FAIL,
error, error,
}); });
@ -350,7 +350,7 @@ const muteAccountSuccess = (relationship: APIEntity, statuses: ImmutableMap<stri
statuses, statuses,
}); });
const muteAccountFail = (error: AxiosError) => ({ const muteAccountFail = (error: unknown) => ({
type: ACCOUNT_MUTE_FAIL, type: ACCOUNT_MUTE_FAIL,
error, error,
}); });
@ -365,7 +365,7 @@ const unmuteAccountSuccess = (relationship: APIEntity) => ({
relationship, relationship,
}); });
const unmuteAccountFail = (error: AxiosError) => ({ const unmuteAccountFail = (error: unknown) => ({
type: ACCOUNT_UNMUTE_FAIL, type: ACCOUNT_UNMUTE_FAIL,
error, error,
}); });
@ -404,7 +404,7 @@ const subscribeAccountSuccess = (relationship: APIEntity) => ({
relationship, relationship,
}); });
const subscribeAccountFail = (error: AxiosError) => ({ const subscribeAccountFail = (error: unknown) => ({
type: ACCOUNT_SUBSCRIBE_FAIL, type: ACCOUNT_SUBSCRIBE_FAIL,
error, error,
}); });
@ -419,7 +419,7 @@ const unsubscribeAccountSuccess = (relationship: APIEntity) => ({
relationship, relationship,
}); });
const unsubscribeAccountFail = (error: AxiosError) => ({ const unsubscribeAccountFail = (error: unknown) => ({
type: ACCOUNT_UNSUBSCRIBE_FAIL, type: ACCOUNT_UNSUBSCRIBE_FAIL,
error, error,
}); });
@ -446,7 +446,7 @@ const removeFromFollowersSuccess = (relationship: APIEntity) => ({
relationship, relationship,
}); });
const removeFromFollowersFail = (id: string, error: AxiosError) => ({ const removeFromFollowersFail = (id: string, error: unknown) => ({
type: ACCOUNT_REMOVE_FROM_FOLLOWERS_FAIL, type: ACCOUNT_REMOVE_FROM_FOLLOWERS_FAIL,
id, id,
error, error,
@ -482,7 +482,7 @@ const fetchFollowersSuccess = (id: string, accounts: APIEntity[], next: string |
next, next,
}); });
const fetchFollowersFail = (id: string, error: AxiosError) => ({ const fetchFollowersFail = (id: string, error: unknown) => ({
type: FOLLOWERS_FETCH_FAIL, type: FOLLOWERS_FETCH_FAIL,
id, id,
error, error,
@ -526,7 +526,7 @@ const expandFollowersSuccess = (id: string, accounts: APIEntity[], next: string
next, next,
}); });
const expandFollowersFail = (id: string, error: AxiosError) => ({ const expandFollowersFail = (id: string, error: unknown) => ({
type: FOLLOWERS_EXPAND_FAIL, type: FOLLOWERS_EXPAND_FAIL,
id, id,
error, error,
@ -562,7 +562,7 @@ const fetchFollowingSuccess = (id: string, accounts: APIEntity[], next: string |
next, next,
}); });
const fetchFollowingFail = (id: string, error: AxiosError) => ({ const fetchFollowingFail = (id: string, error: unknown) => ({
type: FOLLOWING_FETCH_FAIL, type: FOLLOWING_FETCH_FAIL,
id, id,
error, error,
@ -606,7 +606,7 @@ const expandFollowingSuccess = (id: string, accounts: APIEntity[], next: string
next, next,
}); });
const expandFollowingFail = (id: string, error: AxiosError) => ({ const expandFollowingFail = (id: string, error: unknown) => ({
type: FOLLOWING_EXPAND_FAIL, type: FOLLOWING_EXPAND_FAIL,
id, id,
error, error,
@ -646,7 +646,7 @@ const fetchRelationshipsSuccess = (relationships: APIEntity[]) => ({
skipLoading: true, skipLoading: true,
}); });
const fetchRelationshipsFail = (error: AxiosError) => ({ const fetchRelationshipsFail = (error: unknown) => ({
type: RELATIONSHIPS_FETCH_FAIL, type: RELATIONSHIPS_FETCH_FAIL,
error, error,
skipLoading: true, skipLoading: true,
@ -678,7 +678,7 @@ const fetchFollowRequestsSuccess = (accounts: APIEntity[], next: string | null)
next, next,
}); });
const fetchFollowRequestsFail = (error: AxiosError) => ({ const fetchFollowRequestsFail = (error: unknown) => ({
type: FOLLOW_REQUESTS_FETCH_FAIL, type: FOLLOW_REQUESTS_FETCH_FAIL,
error, error,
}); });
@ -715,7 +715,7 @@ const expandFollowRequestsSuccess = (accounts: APIEntity[], next: string | null)
next, next,
}); });
const expandFollowRequestsFail = (error: AxiosError) => ({ const expandFollowRequestsFail = (error: unknown) => ({
type: FOLLOW_REQUESTS_EXPAND_FAIL, type: FOLLOW_REQUESTS_EXPAND_FAIL,
error, error,
}); });
@ -742,7 +742,7 @@ const authorizeFollowRequestSuccess = (id: string) => ({
id, id,
}); });
const authorizeFollowRequestFail = (id: string, error: AxiosError) => ({ const authorizeFollowRequestFail = (id: string, error: unknown) => ({
type: FOLLOW_REQUEST_AUTHORIZE_FAIL, type: FOLLOW_REQUEST_AUTHORIZE_FAIL,
id, id,
error, error,
@ -770,7 +770,7 @@ const rejectFollowRequestSuccess = (id: string) => ({
id, id,
}); });
const rejectFollowRequestFail = (id: string, error: AxiosError) => ({ const rejectFollowRequestFail = (id: string, error: unknown) => ({
type: FOLLOW_REQUEST_REJECT_FAIL, type: FOLLOW_REQUEST_REJECT_FAIL,
id, id,
error, error,
@ -823,7 +823,7 @@ const pinAccountSuccess = (relationship: APIEntity) => ({
relationship, relationship,
}); });
const pinAccountFail = (error: AxiosError) => ({ const pinAccountFail = (error: unknown) => ({
type: ACCOUNT_PIN_FAIL, type: ACCOUNT_PIN_FAIL,
error, error,
}); });
@ -838,7 +838,7 @@ const unpinAccountSuccess = (relationship: APIEntity) => ({
relationship, relationship,
}); });
const unpinAccountFail = (error: AxiosError) => ({ const unpinAccountFail = (error: unknown) => ({
type: ACCOUNT_UNPIN_FAIL, type: ACCOUNT_UNPIN_FAIL,
error, error,
}); });
@ -867,7 +867,7 @@ const fetchPinnedAccountsSuccess = (id: string, accounts: APIEntity[], next: str
next, next,
}); });
const fetchPinnedAccountsFail = (id: string, error: AxiosError) => ({ const fetchPinnedAccountsFail = (id: string, error: unknown) => ({
type: PINNED_ACCOUNTS_FETCH_FAIL, type: PINNED_ACCOUNTS_FETCH_FAIL,
id, id,
error, error,

View File

@ -9,7 +9,6 @@ import api from '../api';
import { importFetchedAccounts } from './importer'; import { importFetchedAccounts } from './importer';
import { patchMeSuccess } from './me'; import { patchMeSuccess } from './me';
import type { AxiosError } from 'axios';
import type { Account } from 'soapbox/schemas'; import type { Account } from 'soapbox/schemas';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store';
@ -61,7 +60,7 @@ const fetchAliasesSuccess = (aliases: unknown[]) => ({
value: aliases, value: aliases,
}); });
const fetchAliasesFail = (error: AxiosError) => ({ const fetchAliasesFail = (error: unknown) => ({
type: ALIASES_FETCH_FAIL, type: ALIASES_FETCH_FAIL,
error, error,
}); });
@ -143,7 +142,7 @@ const addToAliasesSuccess = () => ({
type: ALIASES_ADD_SUCCESS, type: ALIASES_ADD_SUCCESS,
}); });
const addToAliasesFail = (error: AxiosError) => ({ const addToAliasesFail = (error: unknown) => ({
type: ALIASES_ADD_FAIL, type: ALIASES_ADD_FAIL,
error, error,
}); });
@ -196,7 +195,7 @@ const removeFromAliasesSuccess = () => ({
type: ALIASES_REMOVE_SUCCESS, type: ALIASES_REMOVE_SUCCESS,
}); });
const removeFromAliasesFail = (error: AxiosError) => ({ const removeFromAliasesFail = (error: unknown) => ({
type: ALIASES_REMOVE_FAIL, type: ALIASES_REMOVE_FAIL,
error, error,
}); });

View File

@ -3,7 +3,6 @@ import { getFeatures } from 'soapbox/utils/features';
import { importFetchedStatuses } from './importer'; import { importFetchedStatuses } from './importer';
import type { AxiosError } from 'axios';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities';
@ -61,7 +60,7 @@ export const fetchAnnouncementsSuccess = (announcements: APIEntity) => ({
skipLoading: true, skipLoading: true,
}); });
export const fetchAnnouncementsFail = (error: AxiosError) => ({ export const fetchAnnouncementsFail = (error: unknown) => ({
type: ANNOUNCEMENTS_FETCH_FAIL, type: ANNOUNCEMENTS_FETCH_FAIL,
error, error,
skipLoading: true, skipLoading: true,
@ -94,7 +93,7 @@ export const dismissAnnouncementSuccess = (announcementId: string) => ({
id: announcementId, id: announcementId,
}); });
export const dismissAnnouncementFail = (announcementId: string, error: AxiosError) => ({ export const dismissAnnouncementFail = (announcementId: string, error: unknown) => ({
type: ANNOUNCEMENTS_DISMISS_FAIL, type: ANNOUNCEMENTS_DISMISS_FAIL,
id: announcementId, id: announcementId,
error, error,
@ -141,7 +140,7 @@ export const addReactionSuccess = (announcementId: string, name: string, already
skipLoading: true, skipLoading: true,
}); });
export const addReactionFail = (announcementId: string, name: string, error: AxiosError) => ({ export const addReactionFail = (announcementId: string, name: string, error: unknown) => ({
type: ANNOUNCEMENTS_REACTION_ADD_FAIL, type: ANNOUNCEMENTS_REACTION_ADD_FAIL,
id: announcementId, id: announcementId,
name, name,
@ -174,7 +173,7 @@ export const removeReactionSuccess = (announcementId: string, name: string) => (
skipLoading: true, skipLoading: true,
}); });
export const removeReactionFail = (announcementId: string, name: string, error: AxiosError) => ({ export const removeReactionFail = (announcementId: string, name: string, error: unknown) => ({
type: ANNOUNCEMENTS_REACTION_REMOVE_FAIL, type: ANNOUNCEMENTS_REACTION_REMOVE_FAIL,
id: announcementId, id: announcementId,
name, name,

View File

@ -6,7 +6,6 @@ import api, { getLinks } from '../api';
import { fetchRelationships } from './accounts'; import { fetchRelationships } from './accounts';
import { importFetchedAccounts } from './importer'; import { importFetchedAccounts } from './importer';
import type { AxiosError } from 'axios';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store';
const BLOCKS_FETCH_REQUEST = 'BLOCKS_FETCH_REQUEST'; const BLOCKS_FETCH_REQUEST = 'BLOCKS_FETCH_REQUEST';
@ -46,7 +45,7 @@ function fetchBlocksSuccess(accounts: any, next: any) {
}; };
} }
function fetchBlocksFail(error: AxiosError) { function fetchBlocksFail(error: unknown) {
return { return {
type: BLOCKS_FETCH_FAIL, type: BLOCKS_FETCH_FAIL,
error, error,
@ -90,7 +89,7 @@ function expandBlocksSuccess(accounts: any, next: any) {
}; };
} }
function expandBlocksFail(error: AxiosError) { function expandBlocksFail(error: unknown) {
return { return {
type: BLOCKS_EXPAND_FAIL, type: BLOCKS_EXPAND_FAIL,
error, error,

View File

@ -2,7 +2,6 @@ import api, { getLinks } from '../api';
import { importFetchedStatuses } from './importer'; import { importFetchedStatuses } from './importer';
import type { AxiosError } from 'axios';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities';
@ -43,7 +42,7 @@ const fetchBookmarkedStatusesSuccess = (statuses: APIEntity[], next: string | nu
next, next,
}); });
const fetchBookmarkedStatusesFail = (error: AxiosError) => ({ const fetchBookmarkedStatusesFail = (error: unknown) => ({
type: BOOKMARKED_STATUSES_FETCH_FAIL, type: BOOKMARKED_STATUSES_FETCH_FAIL,
error, error,
}); });
@ -77,7 +76,7 @@ const expandBookmarkedStatusesSuccess = (statuses: APIEntity[], next: string | n
next, next,
}); });
const expandBookmarkedStatusesFail = (error: AxiosError) => ({ const expandBookmarkedStatusesFail = (error: unknown) => ({
type: BOOKMARKED_STATUSES_EXPAND_FAIL, type: BOOKMARKED_STATUSES_EXPAND_FAIL,
error, error,
}); });

View File

@ -1,4 +1,4 @@
import axios, { AxiosError, Canceler } from 'axios'; import axios, { Canceler } from 'axios';
import { List as ImmutableList } from 'immutable'; import { List as ImmutableList } from 'immutable';
import throttle from 'lodash/throttle'; import throttle from 'lodash/throttle';
import { defineMessages, IntlShape } from 'react-intl'; import { defineMessages, IntlShape } from 'react-intl';
@ -388,7 +388,7 @@ const submitComposeSuccess = (composeId: string, status: APIEntity) => ({
status: status, status: status,
}); });
const submitComposeFail = (composeId: string, error: AxiosError) => ({ const submitComposeFail = (composeId: string, error: unknown) => ({
type: COMPOSE_SUBMIT_FAIL, type: COMPOSE_SUBMIT_FAIL,
id: composeId, id: composeId,
error: error, error: error,
@ -451,7 +451,7 @@ const uploadComposeSuccess = (composeId: string, media: APIEntity, file: File) =
skipLoading: true, skipLoading: true,
}); });
const uploadComposeFail = (composeId: string, error: AxiosError | true) => ({ const uploadComposeFail = (composeId: string, error: unknown) => ({
type: COMPOSE_UPLOAD_FAIL, type: COMPOSE_UPLOAD_FAIL,
id: composeId, id: composeId,
error: error, error: error,
@ -484,7 +484,7 @@ const changeUploadComposeSuccess = (composeId: string, media: APIEntity) => ({
skipLoading: true, skipLoading: true,
}); });
const changeUploadComposeFail = (composeId: string, id: string, error: AxiosError) => ({ const changeUploadComposeFail = (composeId: string, id: string, error: unknown) => ({
type: COMPOSE_UPLOAD_CHANGE_FAIL, type: COMPOSE_UPLOAD_CHANGE_FAIL,
composeId, composeId,
id, id,

View File

@ -8,7 +8,6 @@ import {
importFetchedStatus, importFetchedStatus,
} from './importer'; } from './importer';
import type { AxiosError } from 'axios';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities';
@ -76,7 +75,7 @@ const expandConversationsSuccess = (conversations: APIEntity[], next: string | n
isLoadingRecent, isLoadingRecent,
}); });
const expandConversationsFail = (error: AxiosError) => ({ const expandConversationsFail = (error: unknown) => ({
type: CONVERSATIONS_FETCH_FAIL, type: CONVERSATIONS_FETCH_FAIL,
error, error,
}); });

View File

@ -1,6 +1,5 @@
import api from '../api'; import api from '../api';
import type { AxiosError } from 'axios';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities';
@ -33,7 +32,7 @@ const fetchCustomEmojisSuccess = (custom_emojis: APIEntity[]) => ({
skipLoading: true, skipLoading: true,
}); });
const fetchCustomEmojisFail = (error: AxiosError) => ({ const fetchCustomEmojisFail = (error: unknown) => ({
type: CUSTOM_EMOJIS_FETCH_FAIL, type: CUSTOM_EMOJIS_FETCH_FAIL,
error, error,
skipLoading: true, skipLoading: true,

View File

@ -3,7 +3,6 @@ import api from '../api';
import { fetchRelationships } from './accounts'; import { fetchRelationships } from './accounts';
import { importFetchedAccounts } from './importer'; import { importFetchedAccounts } from './importer';
import type { AxiosError } from 'axios';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities';
@ -35,7 +34,7 @@ const fetchDirectorySuccess = (accounts: APIEntity[]) => ({
accounts, accounts,
}); });
const fetchDirectoryFail = (error: AxiosError) => ({ const fetchDirectoryFail = (error: unknown) => ({
type: DIRECTORY_FETCH_FAIL, type: DIRECTORY_FETCH_FAIL,
error, error,
}); });
@ -62,7 +61,7 @@ const expandDirectorySuccess = (accounts: APIEntity[]) => ({
accounts, accounts,
}); });
const expandDirectoryFail = (error: AxiosError) => ({ const expandDirectoryFail = (error: unknown) => ({
type: DIRECTORY_EXPAND_FAIL, type: DIRECTORY_EXPAND_FAIL,
error, error,
}); });

View File

@ -3,7 +3,6 @@ import { isLoggedIn } from 'soapbox/utils/auth';
import api, { getLinks } from '../api'; import api, { getLinks } from '../api';
import type { AxiosError } from 'axios';
import type { EntityStore } from 'soapbox/entity-store/types'; import type { EntityStore } from 'soapbox/entity-store/types';
import type { Account } from 'soapbox/schemas'; import type { Account } from 'soapbox/schemas';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store';
@ -50,7 +49,7 @@ const blockDomainSuccess = (domain: string, accounts: string[]) => ({
accounts, accounts,
}); });
const blockDomainFail = (domain: string, error: AxiosError) => ({ const blockDomainFail = (domain: string, error: unknown) => ({
type: DOMAIN_BLOCK_FAIL, type: DOMAIN_BLOCK_FAIL,
domain, domain,
error, error,
@ -88,7 +87,7 @@ const unblockDomainSuccess = (domain: string, accounts: string[]) => ({
accounts, accounts,
}); });
const unblockDomainFail = (domain: string, error: AxiosError) => ({ const unblockDomainFail = (domain: string, error: unknown) => ({
type: DOMAIN_UNBLOCK_FAIL, type: DOMAIN_UNBLOCK_FAIL,
domain, domain,
error, error,
@ -118,7 +117,7 @@ const fetchDomainBlocksSuccess = (domains: string[], next: string | null) => ({
next, next,
}); });
const fetchDomainBlocksFail = (error: AxiosError) => ({ const fetchDomainBlocksFail = (error: unknown) => ({
type: DOMAIN_BLOCKS_FETCH_FAIL, type: DOMAIN_BLOCKS_FETCH_FAIL,
error, error,
}); });
@ -162,7 +161,7 @@ const expandDomainBlocksSuccess = (domains: string[], next: string | null) => ({
next, next,
}); });
const expandDomainBlocksFail = (error: AxiosError) => ({ const expandDomainBlocksFail = (error: unknown) => ({
type: DOMAIN_BLOCKS_EXPAND_FAIL, type: DOMAIN_BLOCKS_EXPAND_FAIL,
error, error,
}); });

View File

@ -7,7 +7,6 @@ import api from '../api';
import { importFetchedAccounts, importFetchedStatus } from './importer'; import { importFetchedAccounts, importFetchedStatus } from './importer';
import { favourite, unfavourite } from './interactions'; import { favourite, unfavourite } from './interactions';
import type { AxiosError } from 'axios';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store';
import type { APIEntity, Status } from 'soapbox/types/entities'; import type { APIEntity, Status } from 'soapbox/types/entities';
@ -114,7 +113,7 @@ const fetchEmojiReactsSuccess = (id: string, emojiReacts: APIEntity[]) => ({
emojiReacts, emojiReacts,
}); });
const fetchEmojiReactsFail = (id: string, error: AxiosError) => ({ const fetchEmojiReactsFail = (id: string, error: unknown) => ({
type: EMOJI_REACTS_FETCH_FAIL, type: EMOJI_REACTS_FETCH_FAIL,
id, id,
error, error,
@ -135,7 +134,7 @@ const emojiReactSuccess = (status: Status, emoji: string) => ({
skipLoading: true, skipLoading: true,
}); });
const emojiReactFail = (status: Status, emoji: string, error: AxiosError) => ({ const emojiReactFail = (status: Status, emoji: string, error: unknown) => ({
type: EMOJI_REACT_FAIL, type: EMOJI_REACT_FAIL,
status, status,
emoji, emoji,
@ -157,7 +156,7 @@ const unEmojiReactSuccess = (status: Status, emoji: string) => ({
skipLoading: true, skipLoading: true,
}); });
const unEmojiReactFail = (status: Status, emoji: string, error: AxiosError) => ({ const unEmojiReactFail = (status: Status, emoji: string, error: unknown) => ({
type: UNEMOJI_REACT_FAIL, type: UNEMOJI_REACT_FAIL,
status, status,
emoji, emoji,

View File

@ -12,7 +12,6 @@ import {
STATUS_FETCH_SOURCE_SUCCESS, STATUS_FETCH_SOURCE_SUCCESS,
} from './statuses'; } from './statuses';
import type { AxiosError } from 'axios';
import type { ReducerStatus } from 'soapbox/reducers/statuses'; import type { ReducerStatus } from 'soapbox/reducers/statuses';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store';
import type { APIEntity, Status as StatusEntity } from 'soapbox/types/entities'; import type { APIEntity, Status as StatusEntity } from 'soapbox/types/entities';
@ -184,7 +183,7 @@ const uploadEventBannerSuccess = (media: APIEntity, file: File) => ({
file, file,
}); });
const uploadEventBannerFail = (error: AxiosError | true) => ({ const uploadEventBannerFail = (error: unknown) => ({
type: EVENT_BANNER_UPLOAD_FAIL, type: EVENT_BANNER_UPLOAD_FAIL,
error, error,
}); });
@ -253,7 +252,7 @@ const submitEventSuccess = (status: APIEntity) => ({
status, status,
}); });
const submitEventFail = (error: AxiosError) => ({ const submitEventFail = (error: unknown) => ({
type: EVENT_SUBMIT_FAIL, type: EVENT_SUBMIT_FAIL,
error, error,
}); });
@ -295,7 +294,7 @@ const joinEventSuccess = (status: APIEntity) => ({
id: status.id, id: status.id,
}); });
const joinEventFail = (error: AxiosError, status: StatusEntity, previousState: string | null) => ({ const joinEventFail = (error: unknown, status: StatusEntity, previousState: string | null) => ({
type: EVENT_JOIN_FAIL, type: EVENT_JOIN_FAIL,
error, error,
id: status.id, id: status.id,
@ -330,7 +329,7 @@ const leaveEventSuccess = (status: APIEntity) => ({
id: status.id, id: status.id,
}); });
const leaveEventFail = (error: AxiosError, status: StatusEntity) => ({ const leaveEventFail = (error: unknown, status: StatusEntity) => ({
type: EVENT_LEAVE_FAIL, type: EVENT_LEAVE_FAIL,
id: status.id, id: status.id,
error, error,
@ -361,7 +360,7 @@ const fetchEventParticipationsSuccess = (id: string, accounts: APIEntity[], next
next, next,
}); });
const fetchEventParticipationsFail = (id: string, error: AxiosError) => ({ const fetchEventParticipationsFail = (id: string, error: unknown) => ({
type: EVENT_PARTICIPATIONS_FETCH_FAIL, type: EVENT_PARTICIPATIONS_FETCH_FAIL,
id, id,
error, error,
@ -398,7 +397,7 @@ const expandEventParticipationsSuccess = (id: string, accounts: APIEntity[], nex
next, next,
}); });
const expandEventParticipationsFail = (id: string, error: AxiosError) => ({ const expandEventParticipationsFail = (id: string, error: unknown) => ({
type: EVENT_PARTICIPATIONS_EXPAND_FAIL, type: EVENT_PARTICIPATIONS_EXPAND_FAIL,
id, id,
error, error,
@ -429,7 +428,7 @@ const fetchEventParticipationRequestsSuccess = (id: string, participations: APIE
next, next,
}); });
const fetchEventParticipationRequestsFail = (id: string, error: AxiosError) => ({ const fetchEventParticipationRequestsFail = (id: string, error: unknown) => ({
type: EVENT_PARTICIPATION_REQUESTS_FETCH_FAIL, type: EVENT_PARTICIPATION_REQUESTS_FETCH_FAIL,
id, id,
error, error,
@ -466,7 +465,7 @@ const expandEventParticipationRequestsSuccess = (id: string, participations: API
next, next,
}); });
const expandEventParticipationRequestsFail = (id: string, error: AxiosError) => ({ const expandEventParticipationRequestsFail = (id: string, error: unknown) => ({
type: EVENT_PARTICIPATION_REQUESTS_EXPAND_FAIL, type: EVENT_PARTICIPATION_REQUESTS_EXPAND_FAIL,
id, id,
error, error,
@ -497,7 +496,7 @@ const authorizeEventParticipationRequestSuccess = (id: string, accountId: string
accountId, accountId,
}); });
const authorizeEventParticipationRequestFail = (id: string, accountId: string, error: AxiosError) => ({ const authorizeEventParticipationRequestFail = (id: string, accountId: string, error: unknown) => ({
type: EVENT_PARTICIPATION_REQUEST_AUTHORIZE_FAIL, type: EVENT_PARTICIPATION_REQUEST_AUTHORIZE_FAIL,
id, id,
accountId, accountId,
@ -529,7 +528,7 @@ const rejectEventParticipationRequestSuccess = (id: string, accountId: string) =
accountId, accountId,
}); });
const rejectEventParticipationRequestFail = (id: string, accountId: string, error: AxiosError) => ({ const rejectEventParticipationRequestFail = (id: string, accountId: string, error: unknown) => ({
type: EVENT_PARTICIPATION_REQUEST_REJECT_FAIL, type: EVENT_PARTICIPATION_REQUEST_REJECT_FAIL,
id, id,
accountId, accountId,

View File

@ -4,7 +4,6 @@ import api, { getLinks } from '../api';
import { importFetchedStatuses } from './importer'; import { importFetchedStatuses } from './importer';
import type { AxiosError } from 'axios';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities';
@ -55,7 +54,7 @@ const fetchFavouritedStatusesSuccess = (statuses: APIEntity[], next: string | nu
skipLoading: true, skipLoading: true,
}); });
const fetchFavouritedStatusesFail = (error: AxiosError) => ({ const fetchFavouritedStatusesFail = (error: unknown) => ({
type: FAVOURITED_STATUSES_FETCH_FAIL, type: FAVOURITED_STATUSES_FETCH_FAIL,
error, error,
skipLoading: true, skipLoading: true,
@ -92,7 +91,7 @@ const expandFavouritedStatusesSuccess = (statuses: APIEntity[], next: string | n
next, next,
}); });
const expandFavouritedStatusesFail = (error: AxiosError) => ({ const expandFavouritedStatusesFail = (error: unknown) => ({
type: FAVOURITED_STATUSES_EXPAND_FAIL, type: FAVOURITED_STATUSES_EXPAND_FAIL,
error, error,
}); });
@ -130,7 +129,7 @@ const fetchAccountFavouritedStatusesSuccess = (accountId: string, statuses: APIE
skipLoading: true, skipLoading: true,
}); });
const fetchAccountFavouritedStatusesFail = (accountId: string, error: AxiosError) => ({ const fetchAccountFavouritedStatusesFail = (accountId: string, error: unknown) => ({
type: ACCOUNT_FAVOURITED_STATUSES_FETCH_FAIL, type: ACCOUNT_FAVOURITED_STATUSES_FETCH_FAIL,
accountId, accountId,
error, error,
@ -170,7 +169,7 @@ const expandAccountFavouritedStatusesSuccess = (accountId: string, statuses: API
next, next,
}); });
const expandAccountFavouritedStatusesFail = (accountId: string, error: AxiosError) => ({ const expandAccountFavouritedStatusesFail = (accountId: string, error: unknown) => ({
type: ACCOUNT_FAVOURITED_STATUSES_EXPAND_FAIL, type: ACCOUNT_FAVOURITED_STATUSES_EXPAND_FAIL,
accountId, accountId,
error, error,

View File

@ -5,7 +5,6 @@ import api, { getLinks } from '../api';
import { fetchRelationships } from './accounts'; import { fetchRelationships } from './accounts';
import { importFetchedGroups, importFetchedAccounts } from './importer'; import { importFetchedGroups, importFetchedAccounts } from './importer';
import type { AxiosError } from 'axios';
import type { GroupRole } from 'soapbox/reducers/group-memberships'; import type { GroupRole } from 'soapbox/reducers/group-memberships';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities';
@ -104,7 +103,7 @@ const deleteGroupSuccess = (id: string) => ({
id, id,
}); });
const deleteGroupFail = (id: string, error: AxiosError) => ({ const deleteGroupFail = (id: string, error: unknown) => ({
type: GROUP_DELETE_FAIL, type: GROUP_DELETE_FAIL,
id, id,
error, error,
@ -132,7 +131,7 @@ const fetchGroupSuccess = (group: APIEntity) => ({
group, group,
}); });
const fetchGroupFail = (id: string, error: AxiosError) => ({ const fetchGroupFail = (id: string, error: unknown) => ({
type: GROUP_FETCH_FAIL, type: GROUP_FETCH_FAIL,
id, id,
error, error,
@ -158,7 +157,7 @@ const fetchGroupsSuccess = (groups: APIEntity[]) => ({
groups, groups,
}); });
const fetchGroupsFail = (error: AxiosError) => ({ const fetchGroupsFail = (error: unknown) => ({
type: GROUPS_FETCH_FAIL, type: GROUPS_FETCH_FAIL,
error, error,
}); });
@ -194,7 +193,7 @@ const fetchGroupRelationshipsSuccess = (relationships: APIEntity[]) => ({
skipLoading: true, skipLoading: true,
}); });
const fetchGroupRelationshipsFail = (error: AxiosError) => ({ const fetchGroupRelationshipsFail = (error: unknown) => ({
type: GROUP_RELATIONSHIPS_FETCH_FAIL, type: GROUP_RELATIONSHIPS_FETCH_FAIL,
error, error,
skipLoading: true, skipLoading: true,
@ -222,7 +221,7 @@ const groupKickSuccess = (groupId: string, accountId: string) => ({
accountId, accountId,
}); });
const groupKickFail = (groupId: string, accountId: string, error: AxiosError) => ({ const groupKickFail = (groupId: string, accountId: string, error: unknown) => ({
type: GROUP_KICK_SUCCESS, type: GROUP_KICK_SUCCESS,
groupId, groupId,
accountId, accountId,
@ -255,7 +254,7 @@ const fetchGroupBlocksSuccess = (id: string, accounts: APIEntity[], next: string
next, next,
}); });
const fetchGroupBlocksFail = (id: string, error: AxiosError) => ({ const fetchGroupBlocksFail = (id: string, error: unknown) => ({
type: GROUP_BLOCKS_FETCH_FAIL, type: GROUP_BLOCKS_FETCH_FAIL,
id, id,
error, error,
@ -295,7 +294,7 @@ const expandGroupBlocksSuccess = (id: string, accounts: APIEntity[], next: strin
next, next,
}); });
const expandGroupBlocksFail = (id: string, error: AxiosError) => ({ const expandGroupBlocksFail = (id: string, error: unknown) => ({
type: GROUP_BLOCKS_EXPAND_FAIL, type: GROUP_BLOCKS_EXPAND_FAIL,
id, id,
error, error,
@ -322,7 +321,7 @@ const groupBlockSuccess = (groupId: string, accountId: string) => ({
accountId, accountId,
}); });
const groupBlockFail = (groupId: string, accountId: string, error: AxiosError) => ({ const groupBlockFail = (groupId: string, accountId: string, error: unknown) => ({
type: GROUP_BLOCK_FAIL, type: GROUP_BLOCK_FAIL,
groupId, groupId,
accountId, accountId,
@ -350,7 +349,7 @@ const groupUnblockSuccess = (groupId: string, accountId: string) => ({
accountId, accountId,
}); });
const groupUnblockFail = (groupId: string, accountId: string, error: AxiosError) => ({ const groupUnblockFail = (groupId: string, accountId: string, error: unknown) => ({
type: GROUP_UNBLOCK_FAIL, type: GROUP_UNBLOCK_FAIL,
groupId, groupId,
accountId, accountId,
@ -379,7 +378,7 @@ const groupPromoteAccountSuccess = (groupId: string, accountId: string, membersh
memberships, memberships,
}); });
const groupPromoteAccountFail = (groupId: string, accountId: string, error: AxiosError) => ({ const groupPromoteAccountFail = (groupId: string, accountId: string, error: unknown) => ({
type: GROUP_PROMOTE_FAIL, type: GROUP_PROMOTE_FAIL,
groupId, groupId,
accountId, accountId,
@ -408,7 +407,7 @@ const groupDemoteAccountSuccess = (groupId: string, accountId: string, membershi
memberships, memberships,
}); });
const groupDemoteAccountFail = (groupId: string, accountId: string, error: AxiosError) => ({ const groupDemoteAccountFail = (groupId: string, accountId: string, error: unknown) => ({
type: GROUP_DEMOTE_FAIL, type: GROUP_DEMOTE_FAIL,
groupId, groupId,
accountId, accountId,
@ -443,7 +442,7 @@ const fetchGroupMembershipsSuccess = (id: string, role: GroupRole, memberships:
next, next,
}); });
const fetchGroupMembershipsFail = (id: string, role: GroupRole, error: AxiosError) => ({ const fetchGroupMembershipsFail = (id: string, role: GroupRole, error: unknown) => ({
type: GROUP_MEMBERSHIPS_FETCH_FAIL, type: GROUP_MEMBERSHIPS_FETCH_FAIL,
id, id,
role, role,
@ -486,7 +485,7 @@ const expandGroupMembershipsSuccess = (id: string, role: GroupRole, memberships:
next, next,
}); });
const expandGroupMembershipsFail = (id: string, role: GroupRole, error: AxiosError) => ({ const expandGroupMembershipsFail = (id: string, role: GroupRole, error: unknown) => ({
type: GROUP_MEMBERSHIPS_EXPAND_FAIL, type: GROUP_MEMBERSHIPS_EXPAND_FAIL,
id, id,
role, role,
@ -519,7 +518,7 @@ const fetchGroupMembershipRequestsSuccess = (id: string, accounts: APIEntity[],
next, next,
}); });
const fetchGroupMembershipRequestsFail = (id: string, error: AxiosError) => ({ const fetchGroupMembershipRequestsFail = (id: string, error: unknown) => ({
type: GROUP_MEMBERSHIP_REQUESTS_FETCH_FAIL, type: GROUP_MEMBERSHIP_REQUESTS_FETCH_FAIL,
id, id,
error, error,
@ -559,7 +558,7 @@ const expandGroupMembershipRequestsSuccess = (id: string, accounts: APIEntity[],
next, next,
}); });
const expandGroupMembershipRequestsFail = (id: string, error: AxiosError) => ({ const expandGroupMembershipRequestsFail = (id: string, error: unknown) => ({
type: GROUP_MEMBERSHIP_REQUESTS_EXPAND_FAIL, type: GROUP_MEMBERSHIP_REQUESTS_EXPAND_FAIL,
id, id,
error, error,
@ -587,7 +586,7 @@ const authorizeGroupMembershipRequestSuccess = (groupId: string, accountId: stri
accountId, accountId,
}); });
const authorizeGroupMembershipRequestFail = (groupId: string, accountId: string, error: AxiosError) => ({ const authorizeGroupMembershipRequestFail = (groupId: string, accountId: string, error: unknown) => ({
type: GROUP_MEMBERSHIP_REQUEST_AUTHORIZE_FAIL, type: GROUP_MEMBERSHIP_REQUEST_AUTHORIZE_FAIL,
groupId, groupId,
accountId, accountId,
@ -616,7 +615,7 @@ const rejectGroupMembershipRequestSuccess = (groupId: string, accountId: string)
accountId, accountId,
}); });
const rejectGroupMembershipRequestFail = (groupId: string, accountId: string, error?: AxiosError) => ({ const rejectGroupMembershipRequestFail = (groupId: string, accountId: string, error?: unknown) => ({
type: GROUP_MEMBERSHIP_REQUEST_REJECT_FAIL, type: GROUP_MEMBERSHIP_REQUEST_REJECT_FAIL,
groupId, groupId,
accountId, accountId,

View File

@ -2,7 +2,6 @@ import api from 'soapbox/api';
import { importFetchedAccounts } from './importer'; import { importFetchedAccounts } from './importer';
import type { AxiosError } from 'axios';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities';
@ -37,7 +36,7 @@ const fetchHistorySuccess = (statusId: String, history: APIEntity[]) => ({
history, history,
}); });
const fetchHistoryFail = (error: AxiosError) => ({ const fetchHistoryFail = (error: unknown) => ({
type: HISTORY_FETCH_FAIL, type: HISTORY_FETCH_FAIL,
error, error,
}); });

View File

@ -9,7 +9,6 @@ import { fetchRelationships } from './accounts';
import { importFetchedAccounts, importFetchedStatus } from './importer'; import { importFetchedAccounts, importFetchedStatus } from './importer';
import { expandGroupFeaturedTimeline } from './timelines'; import { expandGroupFeaturedTimeline } from './timelines';
import type { AxiosError } from 'axios';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store';
import type { APIEntity, Group, Status as StatusEntity } from 'soapbox/types/entities'; import type { APIEntity, Group, Status as StatusEntity } from 'soapbox/types/entities';
@ -135,7 +134,7 @@ const reblogSuccess = (status: StatusEntity) => ({
skipLoading: true, skipLoading: true,
}); });
const reblogFail = (status: StatusEntity, error: AxiosError) => ({ const reblogFail = (status: StatusEntity, error: unknown) => ({
type: REBLOG_FAIL, type: REBLOG_FAIL,
status: status, status: status,
error: error, error: error,
@ -154,7 +153,7 @@ const unreblogSuccess = (status: StatusEntity) => ({
skipLoading: true, skipLoading: true,
}); });
const unreblogFail = (status: StatusEntity, error: AxiosError) => ({ const unreblogFail = (status: StatusEntity, error: unknown) => ({
type: UNREBLOG_FAIL, type: UNREBLOG_FAIL,
status: status, status: status,
error: error, error: error,
@ -208,7 +207,7 @@ const favouriteSuccess = (status: StatusEntity) => ({
skipLoading: true, skipLoading: true,
}); });
const favouriteFail = (status: StatusEntity, error: AxiosError) => ({ const favouriteFail = (status: StatusEntity, error: unknown) => ({
type: FAVOURITE_FAIL, type: FAVOURITE_FAIL,
status: status, status: status,
error: error, error: error,
@ -227,7 +226,7 @@ const unfavouriteSuccess = (status: StatusEntity) => ({
skipLoading: true, skipLoading: true,
}); });
const unfavouriteFail = (status: StatusEntity, error: AxiosError) => ({ const unfavouriteFail = (status: StatusEntity, error: unknown) => ({
type: UNFAVOURITE_FAIL, type: UNFAVOURITE_FAIL,
status: status, status: status,
error: error, error: error,
@ -281,7 +280,7 @@ const dislikeSuccess = (status: StatusEntity) => ({
skipLoading: true, skipLoading: true,
}); });
const dislikeFail = (status: StatusEntity, error: AxiosError) => ({ const dislikeFail = (status: StatusEntity, error: unknown) => ({
type: DISLIKE_FAIL, type: DISLIKE_FAIL,
status: status, status: status,
error: error, error: error,
@ -300,7 +299,7 @@ const undislikeSuccess = (status: StatusEntity) => ({
skipLoading: true, skipLoading: true,
}); });
const undislikeFail = (status: StatusEntity, error: AxiosError) => ({ const undislikeFail = (status: StatusEntity, error: unknown) => ({
type: UNDISLIKE_FAIL, type: UNDISLIKE_FAIL,
status: status, status: status,
error: error, error: error,
@ -356,7 +355,7 @@ const bookmarkSuccess = (status: StatusEntity, response: APIEntity) => ({
response: response, response: response,
}); });
const bookmarkFail = (status: StatusEntity, error: AxiosError) => ({ const bookmarkFail = (status: StatusEntity, error: unknown) => ({
type: BOOKMARK_FAIL, type: BOOKMARK_FAIL,
status: status, status: status,
error: error, error: error,
@ -373,7 +372,7 @@ const unbookmarkSuccess = (status: StatusEntity, response: APIEntity) => ({
response: response, response: response,
}); });
const unbookmarkFail = (status: StatusEntity, error: AxiosError) => ({ const unbookmarkFail = (status: StatusEntity, error: unknown) => ({
type: UNBOOKMARK_FAIL, type: UNBOOKMARK_FAIL,
status: status, status: status,
error, error,
@ -407,7 +406,7 @@ const fetchReblogsSuccess = (id: string, accounts: APIEntity[], next: string | n
next, next,
}); });
const fetchReblogsFail = (id: string, error: AxiosError) => ({ const fetchReblogsFail = (id: string, error: unknown) => ({
type: REBLOGS_FETCH_FAIL, type: REBLOGS_FETCH_FAIL,
id, id,
error, error,
@ -432,7 +431,7 @@ const expandReblogsSuccess = (id: string, accounts: APIEntity[], next: string |
next, next,
}); });
const expandReblogsFail = (id: string, error: AxiosError) => ({ const expandReblogsFail = (id: string, error: unknown) => ({
type: REBLOGS_EXPAND_FAIL, type: REBLOGS_EXPAND_FAIL,
id, id,
error, error,
@ -466,7 +465,7 @@ const fetchFavouritesSuccess = (id: string, accounts: APIEntity[], next: string
next, next,
}); });
const fetchFavouritesFail = (id: string, error: AxiosError) => ({ const fetchFavouritesFail = (id: string, error: unknown) => ({
type: FAVOURITES_FETCH_FAIL, type: FAVOURITES_FETCH_FAIL,
id, id,
error, error,
@ -491,7 +490,7 @@ const expandFavouritesSuccess = (id: string, accounts: APIEntity[], next: string
next, next,
}); });
const expandFavouritesFail = (id: string, error: AxiosError) => ({ const expandFavouritesFail = (id: string, error: unknown) => ({
type: FAVOURITES_EXPAND_FAIL, type: FAVOURITES_EXPAND_FAIL,
id, id,
error, error,
@ -523,7 +522,7 @@ const fetchDislikesSuccess = (id: string, accounts: APIEntity[]) => ({
accounts, accounts,
}); });
const fetchDislikesFail = (id: string, error: AxiosError) => ({ const fetchDislikesFail = (id: string, error: unknown) => ({
type: DISLIKES_FETCH_FAIL, type: DISLIKES_FETCH_FAIL,
id, id,
error, error,
@ -552,7 +551,7 @@ const fetchReactionsSuccess = (id: string, reactions: APIEntity[]) => ({
reactions, reactions,
}); });
const fetchReactionsFail = (id: string, error: AxiosError) => ({ const fetchReactionsFail = (id: string, error: unknown) => ({
type: REACTIONS_FETCH_FAIL, type: REACTIONS_FETCH_FAIL,
id, id,
error, error,
@ -598,7 +597,7 @@ const pinSuccess = (status: StatusEntity) => ({
skipLoading: true, skipLoading: true,
}); });
const pinFail = (status: StatusEntity, error: AxiosError) => ({ const pinFail = (status: StatusEntity, error: unknown) => ({
type: PIN_FAIL, type: PIN_FAIL,
status, status,
error, error,
@ -640,7 +639,7 @@ const unpinSuccess = (status: StatusEntity) => ({
skipLoading: true, skipLoading: true,
}); });
const unpinFail = (status: StatusEntity, error: AxiosError) => ({ const unpinFail = (status: StatusEntity, error: unknown) => ({
type: UNPIN_FAIL, type: UNPIN_FAIL,
status, status,
error, error,
@ -676,7 +675,7 @@ const remoteInteractionSuccess = (ap_id: string, profile: string, url: string) =
url, url,
}); });
const remoteInteractionFail = (ap_id: string, profile: string, error: AxiosError) => ({ const remoteInteractionFail = (ap_id: string, profile: string, error: unknown) => ({
type: REMOTE_INTERACTION_FAIL, type: REMOTE_INTERACTION_FAIL,
ap_id, ap_id,
profile, profile,

View File

@ -6,7 +6,6 @@ import api from '../api';
import { importFetchedAccounts } from './importer'; import { importFetchedAccounts } from './importer';
import type { AxiosError } from 'axios';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities';
@ -81,7 +80,7 @@ const fetchListSuccess = (list: APIEntity) => ({
list, list,
}); });
const fetchListFail = (id: string | number, error: AxiosError) => ({ const fetchListFail = (id: string | number, error: unknown) => ({
type: LIST_FETCH_FAIL, type: LIST_FETCH_FAIL,
id, id,
error, error,
@ -106,7 +105,7 @@ const fetchListsSuccess = (lists: APIEntity[]) => ({
lists, lists,
}); });
const fetchListsFail = (error: AxiosError) => ({ const fetchListsFail = (error: unknown) => ({
type: LISTS_FETCH_FAIL, type: LISTS_FETCH_FAIL,
error, error,
}); });
@ -159,7 +158,7 @@ const createListSuccess = (list: APIEntity) => ({
list, list,
}); });
const createListFail = (error: AxiosError) => ({ const createListFail = (error: unknown) => ({
type: LIST_CREATE_FAIL, type: LIST_CREATE_FAIL,
error, error,
}); });
@ -188,7 +187,7 @@ const updateListSuccess = (list: APIEntity) => ({
list, list,
}); });
const updateListFail = (id: string | number, error: AxiosError) => ({ const updateListFail = (id: string | number, error: unknown) => ({
type: LIST_UPDATE_FAIL, type: LIST_UPDATE_FAIL,
id, id,
error, error,
@ -218,7 +217,7 @@ const deleteListSuccess = (id: string | number) => ({
id, id,
}); });
const deleteListFail = (id: string | number, error: AxiosError) => ({ const deleteListFail = (id: string | number, error: unknown) => ({
type: LIST_DELETE_FAIL, type: LIST_DELETE_FAIL,
id, id,
error, error,
@ -247,7 +246,7 @@ const fetchListAccountsSuccess = (id: string | number, accounts: APIEntity[], ne
next, next,
}); });
const fetchListAccountsFail = (id: string | number, error: AxiosError) => ({ const fetchListAccountsFail = (id: string | number, error: unknown) => ({
type: LIST_ACCOUNTS_FETCH_FAIL, type: LIST_ACCOUNTS_FETCH_FAIL,
id, id,
error, error,
@ -343,7 +342,7 @@ const removeFromListSuccess = (listId: string | number, accountId: string) => ({
accountId, accountId,
}); });
const removeFromListFail = (listId: string | number, accountId: string, error: AxiosError) => ({ const removeFromListFail = (listId: string | number, accountId: string, error: unknown) => ({
type: LIST_EDITOR_REMOVE_FAIL, type: LIST_EDITOR_REMOVE_FAIL,
listId, listId,
accountId, accountId,
@ -384,7 +383,7 @@ const fetchAccountListsSuccess = (id: string, lists: APIEntity[]) => ({
lists, lists,
}); });
const fetchAccountListsFail = (id: string, err: AxiosError) => ({ const fetchAccountListsFail = (id: string, err: unknown) => ({
type: LIST_ADDER_LISTS_FETCH_FAIL, type: LIST_ADDER_LISTS_FETCH_FAIL,
id, id,
err, err,

View File

@ -8,7 +8,7 @@ import api from '../api';
import { loadCredentials } from './auth'; import { loadCredentials } from './auth';
import { importFetchedAccount } from './importer'; import { importFetchedAccount } from './importer';
import type { AxiosError, RawAxiosRequestHeaders } from 'axios'; import type { RawAxiosRequestHeaders } from 'axios';
import type { Account } from 'soapbox/schemas'; import type { Account } from 'soapbox/schemas';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities';
@ -125,7 +125,7 @@ const patchMeSuccess = (me: APIEntity) =>
dispatch(action); dispatch(action);
}; };
const patchMeFail = (error: AxiosError) => ({ const patchMeFail = (error: unknown) => ({
type: ME_PATCH_FAIL, type: ME_PATCH_FAIL,
error, error,
skipAlert: true, skipAlert: true,

View File

@ -8,7 +8,6 @@ import resizeImage from 'soapbox/utils/resize-image';
import api from '../api'; import api from '../api';
import type { AxiosError } from 'axios';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities';
@ -59,7 +58,7 @@ const uploadFile = (
file: File, file: File,
intl: IntlShape, intl: IntlShape,
onSuccess: (data: APIEntity) => void = () => {}, onSuccess: (data: APIEntity) => void = () => {},
onFail: (error: AxiosError | true) => void = () => {}, onFail: (error: unknown) => void = () => {},
onProgress: (loaded: number) => void = () => {}, onProgress: (loaded: number) => void = () => {},
changeTotal: (value: number) => void = () => {}, changeTotal: (value: number) => void = () => {},
) => ) =>

View File

@ -1,6 +1,5 @@
import api from '../api'; import api from '../api';
import type { AxiosError } from 'axios';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store';
const MFA_FETCH_REQUEST = 'MFA_FETCH_REQUEST'; const MFA_FETCH_REQUEST = 'MFA_FETCH_REQUEST';
@ -50,7 +49,7 @@ const setupMfa = (method: string) =>
return api(getState).get(`/api/pleroma/accounts/mfa/setup/${method}`).then(({ data }) => { return api(getState).get(`/api/pleroma/accounts/mfa/setup/${method}`).then(({ data }) => {
dispatch({ type: MFA_SETUP_SUCCESS, data }); dispatch({ type: MFA_SETUP_SUCCESS, data });
return data; return data;
}).catch((error: AxiosError) => { }).catch((error: unknown) => {
dispatch({ type: MFA_SETUP_FAIL }); dispatch({ type: MFA_SETUP_FAIL });
throw error; throw error;
}); });
@ -63,7 +62,7 @@ const confirmMfa = (method: string, code: string, password: string) =>
return api(getState).post(`/api/pleroma/accounts/mfa/confirm/${method}`, params).then(({ data }) => { return api(getState).post(`/api/pleroma/accounts/mfa/confirm/${method}`, params).then(({ data }) => {
dispatch({ type: MFA_CONFIRM_SUCCESS, method, code }); dispatch({ type: MFA_CONFIRM_SUCCESS, method, code });
return data; return data;
}).catch((error: AxiosError) => { }).catch((error: unknown) => {
dispatch({ type: MFA_CONFIRM_FAIL, method, code, error, skipAlert: true }); dispatch({ type: MFA_CONFIRM_FAIL, method, code, error, skipAlert: true });
throw error; throw error;
}); });
@ -75,7 +74,7 @@ const disableMfa = (method: string, password: string) =>
return api(getState).delete(`/api/pleroma/accounts/mfa/${method}`, { data: { password } }).then(({ data }) => { return api(getState).delete(`/api/pleroma/accounts/mfa/${method}`, { data: { password } }).then(({ data }) => {
dispatch({ type: MFA_DISABLE_SUCCESS, method }); dispatch({ type: MFA_DISABLE_SUCCESS, method });
return data; return data;
}).catch((error: AxiosError) => { }).catch((error: unknown) => {
dispatch({ type: MFA_DISABLE_FAIL, method, skipAlert: true }); dispatch({ type: MFA_DISABLE_FAIL, method, skipAlert: true });
throw error; throw error;
}); });

View File

@ -22,7 +22,6 @@ import {
import { saveMarker } from './markers'; import { saveMarker } from './markers';
import { getSettings, saveSettings } from './settings'; import { getSettings, saveSettings } from './settings';
import type { AxiosError } from 'axios';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store';
import type { APIEntity, Status } from 'soapbox/types/entities'; import type { APIEntity, Status } from 'soapbox/types/entities';
@ -262,7 +261,7 @@ const expandNotificationsSuccess = (notifications: APIEntity[], next: string | n
skipLoading: !isLoadingMore, skipLoading: !isLoadingMore,
}); });
const expandNotificationsFail = (error: AxiosError, isLoadingMore: boolean) => ({ const expandNotificationsFail = (error: unknown, isLoadingMore: boolean) => ({
type: NOTIFICATIONS_EXPAND_FAIL, type: NOTIFICATIONS_EXPAND_FAIL,
error, error,
skipLoading: !isLoadingMore, skipLoading: !isLoadingMore,

View File

@ -1,6 +1,5 @@
import api from '../api'; import api from '../api';
import type { AxiosError } from 'axios';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities';
@ -38,7 +37,7 @@ const importFetchedInstance = (instance: APIEntity) => ({
instance, instance,
}); });
const fetchInstanceFail = (error: AxiosError) => ({ const fetchInstanceFail = (error: unknown) => ({
type: PATRON_INSTANCE_FETCH_FAIL, type: PATRON_INSTANCE_FETCH_FAIL,
error, error,
skipAlert: true, skipAlert: true,
@ -49,7 +48,7 @@ const importFetchedAccount = (account: APIEntity) => ({
account, account,
}); });
const fetchAccountFail = (error: AxiosError) => ({ const fetchAccountFail = (error: unknown) => ({
type: PATRON_ACCOUNT_FETCH_FAIL, type: PATRON_ACCOUNT_FETCH_FAIL,
error, error,
skipAlert: true, skipAlert: true,

View File

@ -4,7 +4,6 @@ import api from '../api';
import { importFetchedStatuses } from './importer'; import { importFetchedStatuses } from './importer';
import type { AxiosError } from 'axios';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities';
@ -37,7 +36,7 @@ const fetchPinnedStatusesSuccess = (statuses: APIEntity[], next: string | null)
next, next,
}); });
const fetchPinnedStatusesFail = (error: AxiosError) => ({ const fetchPinnedStatusesFail = (error: unknown) => ({
type: PINNED_STATUSES_FETCH_FAIL, type: PINNED_STATUSES_FETCH_FAIL,
error, error,
}); });

View File

@ -2,7 +2,6 @@ import api from '../api';
import { importFetchedPoll } from './importer'; import { importFetchedPoll } from './importer';
import type { AxiosError } from 'axios';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities';
@ -47,7 +46,7 @@ const voteSuccess = (poll: APIEntity) => ({
poll, poll,
}); });
const voteFail = (error: AxiosError) => ({ const voteFail = (error: unknown) => ({
type: POLL_VOTE_FAIL, type: POLL_VOTE_FAIL,
error, error,
}); });
@ -61,7 +60,7 @@ const fetchPollSuccess = (poll: APIEntity) => ({
poll, poll,
}); });
const fetchPollFail = (error: AxiosError) => ({ const fetchPollFail = (error: unknown) => ({
type: POLL_FETCH_FAIL, type: POLL_FETCH_FAIL,
error, error,
}); });

View File

@ -2,7 +2,6 @@ import api from '../api';
import { openModal } from './modals'; import { openModal } from './modals';
import type { AxiosError } from 'axios';
import type { Account } from 'soapbox/schemas'; import type { Account } from 'soapbox/schemas';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store';
import type { ChatMessage, Group, Status } from 'soapbox/types/entities'; import type { ChatMessage, Group, Status } from 'soapbox/types/entities';
@ -83,7 +82,7 @@ const submitReportSuccess = () => ({
type: REPORT_SUBMIT_SUCCESS, type: REPORT_SUBMIT_SUCCESS,
}); });
const submitReportFail = (error: AxiosError) => ({ const submitReportFail = (error: unknown) => ({
type: REPORT_SUBMIT_FAIL, type: REPORT_SUBMIT_FAIL,
error, error,
}); });

View File

@ -2,7 +2,6 @@ import { getFeatures } from 'soapbox/utils/features';
import api, { getLinks } from '../api'; import api, { getLinks } from '../api';
import type { AxiosError } from 'axios';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities';
@ -61,7 +60,7 @@ const fetchScheduledStatusesSuccess = (statuses: APIEntity[], next: string | nul
next, next,
}); });
const fetchScheduledStatusesFail = (error: AxiosError) => ({ const fetchScheduledStatusesFail = (error: unknown) => ({
type: SCHEDULED_STATUSES_FETCH_FAIL, type: SCHEDULED_STATUSES_FETCH_FAIL,
error, error,
}); });
@ -94,7 +93,7 @@ const expandScheduledStatusesSuccess = (statuses: APIEntity[], next: string | nu
next, next,
}); });
const expandScheduledStatusesFail = (error: AxiosError) => ({ const expandScheduledStatusesFail = (error: unknown) => ({
type: SCHEDULED_STATUSES_EXPAND_FAIL, type: SCHEDULED_STATUSES_EXPAND_FAIL,
error, error,
}); });

View File

@ -3,7 +3,6 @@ import api, { getLinks } from '../api';
import { fetchRelationships } from './accounts'; import { fetchRelationships } from './accounts';
import { importFetchedAccounts, importFetchedStatuses } from './importer'; import { importFetchedAccounts, importFetchedStatuses } from './importer';
import type { AxiosError } from 'axios';
import type { SearchFilter } from 'soapbox/reducers/search'; import type { SearchFilter } from 'soapbox/reducers/search';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities';
@ -105,7 +104,7 @@ const fetchSearchSuccess = (results: APIEntity[], searchTerm: string, searchType
next, next,
}); });
const fetchSearchFail = (error: AxiosError) => ({ const fetchSearchFail = (error: unknown) => ({
type: SEARCH_FETCH_FAIL, type: SEARCH_FETCH_FAIL,
error, error,
}); });
@ -178,7 +177,7 @@ const expandSearchSuccess = (results: APIEntity[], searchTerm: string, searchTyp
next, next,
}); });
const expandSearchFail = (error: AxiosError) => ({ const expandSearchFail = (error: unknown) => ({
type: SEARCH_EXPAND_FAIL, type: SEARCH_EXPAND_FAIL,
error, error,
}); });

View File

@ -8,7 +8,6 @@ import { getFeatures } from 'soapbox/utils/features';
import api, { staticClient } from '../api'; import api, { staticClient } from '../api';
import type { AxiosError } from 'axios';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities';
@ -106,7 +105,7 @@ const importSoapboxConfig = (soapboxConfig: APIEntity, host: string | null) => {
}; };
}; };
const soapboxConfigFail = (error: AxiosError, host: string | null) => ({ const soapboxConfigFail = (error: unknown, host: string | null) => ({
type: SOAPBOX_CONFIG_REQUEST_FAIL, type: SOAPBOX_CONFIG_REQUEST_FAIL,
error, error,
skipAlert: true, skipAlert: true,

View File

@ -1,6 +1,5 @@
import api, { getLinks } from '../api'; import api, { getLinks } from '../api';
import type { AxiosError } from 'axios';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities';
@ -44,7 +43,7 @@ const fetchHashtagSuccess = (name: string, tag: APIEntity) => ({
tag, tag,
}); });
const fetchHashtagFail = (error: AxiosError) => ({ const fetchHashtagFail = (error: unknown) => ({
type: HASHTAG_FETCH_FAIL, type: HASHTAG_FETCH_FAIL,
error, error,
}); });
@ -70,7 +69,7 @@ const followHashtagSuccess = (name: string, tag: APIEntity) => ({
tag, tag,
}); });
const followHashtagFail = (name: string, error: AxiosError) => ({ const followHashtagFail = (name: string, error: unknown) => ({
type: HASHTAG_FOLLOW_FAIL, type: HASHTAG_FOLLOW_FAIL,
name, name,
error, error,
@ -97,7 +96,7 @@ const unfollowHashtagSuccess = (name: string, tag: APIEntity) => ({
tag, tag,
}); });
const unfollowHashtagFail = (name: string, error: AxiosError) => ({ const unfollowHashtagFail = (name: string, error: unknown) => ({
type: HASHTAG_UNFOLLOW_FAIL, type: HASHTAG_UNFOLLOW_FAIL,
name, name,
error, error,
@ -124,7 +123,7 @@ const fetchFollowedHashtagsSuccess = (followed_tags: APIEntity[], next: string |
next, next,
}); });
const fetchFollowedHashtagsFail = (error: AxiosError) => ({ const fetchFollowedHashtagsFail = (error: unknown) => ({
type: FOLLOWED_HASHTAGS_FETCH_FAIL, type: FOLLOWED_HASHTAGS_FETCH_FAIL,
error, error,
}); });
@ -156,7 +155,7 @@ const expandFollowedHashtagsSuccess = (followed_tags: APIEntity[], next: string
next, next,
}); });
const expandFollowedHashtagsFail = (error: AxiosError) => ({ const expandFollowedHashtagsFail = (error: unknown) => ({
type: FOLLOWED_HASHTAGS_EXPAND_FAIL, type: FOLLOWED_HASHTAGS_EXPAND_FAIL,
error, error,
}); });

View File

@ -9,7 +9,6 @@ import api, { getNextLink, getPrevLink } from '../api';
import { fetchGroupRelationships } from './groups'; import { fetchGroupRelationships } from './groups';
import { importFetchedStatus, importFetchedStatuses } from './importer'; import { importFetchedStatus, importFetchedStatuses } from './importer';
import type { AxiosError } from 'axios';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store';
import type { APIEntity, Status } from 'soapbox/types/entities'; import type { APIEntity, Status } from 'soapbox/types/entities';
@ -284,7 +283,7 @@ const expandTimelineSuccess = (
skipLoading: !isLoadingMore, skipLoading: !isLoadingMore,
}); });
const expandTimelineFail = (timeline: string, error: AxiosError, isLoadingMore: boolean) => ({ const expandTimelineFail = (timeline: string, error: unknown, isLoadingMore: boolean) => ({
type: TIMELINE_EXPAND_FAIL, type: TIMELINE_EXPAND_FAIL,
timeline, timeline,
error, error,

View File

@ -1,6 +1,5 @@
import api from '../api'; import api from '../api';
import type { AxiosError } from 'axios';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities';
@ -28,7 +27,7 @@ const fetchTrendsSuccess = (tags: APIEntity[]) => ({
skipLoading: true, skipLoading: true,
}); });
const fetchTrendsFail = (error: AxiosError) => ({ const fetchTrendsFail = (error: unknown) => ({
type: TRENDS_FETCH_FAIL, type: TRENDS_FETCH_FAIL,
error, error,
skipLoading: true, skipLoading: true,

View File

@ -17,8 +17,6 @@ import ConfirmationStep from './steps/confirmation-step';
import OtherActionsStep from './steps/other-actions-step'; import OtherActionsStep from './steps/other-actions-step';
import ReasonStep from './steps/reason-step'; import ReasonStep from './steps/reason-step';
import type { AxiosError } from 'axios';
const messages = defineMessages({ const messages = defineMessages({
blankslate: { id: 'report.reason.blankslate', defaultMessage: 'You have removed all statuses from being selected.' }, blankslate: { id: 'report.reason.blankslate', defaultMessage: 'You have removed all statuses from being selected.' },
done: { id: 'report.done', defaultMessage: 'Done' }, done: { id: 'report.done', defaultMessage: 'Done' },
@ -123,7 +121,7 @@ const ReportModal = ({ onClose }: IReportModal) => {
const handleSubmit = () => { const handleSubmit = () => {
dispatch(submitReport()) dispatch(submitReport())
.then(() => setCurrentStep(Steps.THREE)) .then(() => setCurrentStep(Steps.THREE))
.catch((error: AxiosError) => dispatch(submitReportFail(error))); .catch((error) => dispatch(submitReportFail(error)));
if (isBlocked && account) { if (isBlocked && account) {
dispatch(blockAccount(account.id)); dispatch(blockAccount(account.id));

View File

@ -1,5 +1,4 @@
import { useMutation } from '@tanstack/react-query'; import { useMutation } from '@tanstack/react-query';
import { AxiosError } from 'axios';
import { fetchRelationshipsFail, fetchRelationshipsSuccess } from 'soapbox/actions/accounts'; import { fetchRelationshipsFail, fetchRelationshipsSuccess } from 'soapbox/actions/accounts';
import { useApi, useAppDispatch } from 'soapbox/hooks'; import { useApi, useAppDispatch } from 'soapbox/hooks';
@ -17,7 +16,7 @@ const useFetchRelationships = () => {
onSuccess(response) { onSuccess(response) {
dispatch(fetchRelationshipsSuccess(response.data)); dispatch(fetchRelationshipsSuccess(response.data));
}, },
onError(error: AxiosError) { onError(error) {
dispatch(fetchRelationshipsFail(error)); dispatch(fetchRelationshipsFail(error));
}, },
}); });