diff --git a/src/actions/account-notes.ts b/src/actions/account-notes.ts index 0194c6f81..7afd5e283 100644 --- a/src/actions/account-notes.ts +++ b/src/actions/account-notes.ts @@ -1,6 +1,5 @@ import api from '../api'; -import type { AxiosError } from 'axios'; import type { AnyAction } from 'redux'; import type { RootState } from 'soapbox/store'; @@ -31,7 +30,7 @@ const submitAccountNoteSuccess = (relationship: any) => ({ relationship, }); -const submitAccountNoteFail = (error: AxiosError) => ({ +const submitAccountNoteFail = (error: unknown) => ({ type: ACCOUNT_NOTE_SUBMIT_FAIL, error, }); diff --git a/src/actions/accounts.ts b/src/actions/accounts.ts index 779966596..4c7df890c 100644 --- a/src/actions/accounts.ts +++ b/src/actions/accounts.ts @@ -224,7 +224,7 @@ const fetchAccountSuccess = (account: APIEntity) => ({ account, }); -const fetchAccountFail = (id: string | null, error: AxiosError) => ({ +const fetchAccountFail = (id: string | null, error: unknown) => ({ type: ACCOUNT_FETCH_FAIL, id, error, @@ -272,7 +272,7 @@ const blockAccountSuccess = (relationship: APIEntity, statuses: ImmutableMap ({ +const blockAccountFail = (error: unknown) => ({ type: ACCOUNT_BLOCK_FAIL, error, }); @@ -287,7 +287,7 @@ const unblockAccountSuccess = (relationship: APIEntity) => ({ relationship, }); -const unblockAccountFail = (error: AxiosError) => ({ +const unblockAccountFail = (error: unknown) => ({ type: ACCOUNT_UNBLOCK_FAIL, error, }); @@ -350,7 +350,7 @@ const muteAccountSuccess = (relationship: APIEntity, statuses: ImmutableMap ({ +const muteAccountFail = (error: unknown) => ({ type: ACCOUNT_MUTE_FAIL, error, }); @@ -365,7 +365,7 @@ const unmuteAccountSuccess = (relationship: APIEntity) => ({ relationship, }); -const unmuteAccountFail = (error: AxiosError) => ({ +const unmuteAccountFail = (error: unknown) => ({ type: ACCOUNT_UNMUTE_FAIL, error, }); @@ -404,7 +404,7 @@ const subscribeAccountSuccess = (relationship: APIEntity) => ({ relationship, }); -const subscribeAccountFail = (error: AxiosError) => ({ +const subscribeAccountFail = (error: unknown) => ({ type: ACCOUNT_SUBSCRIBE_FAIL, error, }); @@ -419,7 +419,7 @@ const unsubscribeAccountSuccess = (relationship: APIEntity) => ({ relationship, }); -const unsubscribeAccountFail = (error: AxiosError) => ({ +const unsubscribeAccountFail = (error: unknown) => ({ type: ACCOUNT_UNSUBSCRIBE_FAIL, error, }); @@ -446,7 +446,7 @@ const removeFromFollowersSuccess = (relationship: APIEntity) => ({ relationship, }); -const removeFromFollowersFail = (id: string, error: AxiosError) => ({ +const removeFromFollowersFail = (id: string, error: unknown) => ({ type: ACCOUNT_REMOVE_FROM_FOLLOWERS_FAIL, id, error, @@ -482,7 +482,7 @@ const fetchFollowersSuccess = (id: string, accounts: APIEntity[], next: string | next, }); -const fetchFollowersFail = (id: string, error: AxiosError) => ({ +const fetchFollowersFail = (id: string, error: unknown) => ({ type: FOLLOWERS_FETCH_FAIL, id, error, @@ -526,7 +526,7 @@ const expandFollowersSuccess = (id: string, accounts: APIEntity[], next: string next, }); -const expandFollowersFail = (id: string, error: AxiosError) => ({ +const expandFollowersFail = (id: string, error: unknown) => ({ type: FOLLOWERS_EXPAND_FAIL, id, error, @@ -562,7 +562,7 @@ const fetchFollowingSuccess = (id: string, accounts: APIEntity[], next: string | next, }); -const fetchFollowingFail = (id: string, error: AxiosError) => ({ +const fetchFollowingFail = (id: string, error: unknown) => ({ type: FOLLOWING_FETCH_FAIL, id, error, @@ -606,7 +606,7 @@ const expandFollowingSuccess = (id: string, accounts: APIEntity[], next: string next, }); -const expandFollowingFail = (id: string, error: AxiosError) => ({ +const expandFollowingFail = (id: string, error: unknown) => ({ type: FOLLOWING_EXPAND_FAIL, id, error, @@ -646,7 +646,7 @@ const fetchRelationshipsSuccess = (relationships: APIEntity[]) => ({ skipLoading: true, }); -const fetchRelationshipsFail = (error: AxiosError) => ({ +const fetchRelationshipsFail = (error: unknown) => ({ type: RELATIONSHIPS_FETCH_FAIL, error, skipLoading: true, @@ -678,7 +678,7 @@ const fetchFollowRequestsSuccess = (accounts: APIEntity[], next: string | null) next, }); -const fetchFollowRequestsFail = (error: AxiosError) => ({ +const fetchFollowRequestsFail = (error: unknown) => ({ type: FOLLOW_REQUESTS_FETCH_FAIL, error, }); @@ -715,7 +715,7 @@ const expandFollowRequestsSuccess = (accounts: APIEntity[], next: string | null) next, }); -const expandFollowRequestsFail = (error: AxiosError) => ({ +const expandFollowRequestsFail = (error: unknown) => ({ type: FOLLOW_REQUESTS_EXPAND_FAIL, error, }); @@ -742,7 +742,7 @@ const authorizeFollowRequestSuccess = (id: string) => ({ id, }); -const authorizeFollowRequestFail = (id: string, error: AxiosError) => ({ +const authorizeFollowRequestFail = (id: string, error: unknown) => ({ type: FOLLOW_REQUEST_AUTHORIZE_FAIL, id, error, @@ -770,7 +770,7 @@ const rejectFollowRequestSuccess = (id: string) => ({ id, }); -const rejectFollowRequestFail = (id: string, error: AxiosError) => ({ +const rejectFollowRequestFail = (id: string, error: unknown) => ({ type: FOLLOW_REQUEST_REJECT_FAIL, id, error, @@ -823,7 +823,7 @@ const pinAccountSuccess = (relationship: APIEntity) => ({ relationship, }); -const pinAccountFail = (error: AxiosError) => ({ +const pinAccountFail = (error: unknown) => ({ type: ACCOUNT_PIN_FAIL, error, }); @@ -838,7 +838,7 @@ const unpinAccountSuccess = (relationship: APIEntity) => ({ relationship, }); -const unpinAccountFail = (error: AxiosError) => ({ +const unpinAccountFail = (error: unknown) => ({ type: ACCOUNT_UNPIN_FAIL, error, }); @@ -867,7 +867,7 @@ const fetchPinnedAccountsSuccess = (id: string, accounts: APIEntity[], next: str next, }); -const fetchPinnedAccountsFail = (id: string, error: AxiosError) => ({ +const fetchPinnedAccountsFail = (id: string, error: unknown) => ({ type: PINNED_ACCOUNTS_FETCH_FAIL, id, error, diff --git a/src/actions/aliases.ts b/src/actions/aliases.ts index e485ea14e..652bde8b5 100644 --- a/src/actions/aliases.ts +++ b/src/actions/aliases.ts @@ -9,7 +9,6 @@ import api from '../api'; import { importFetchedAccounts } from './importer'; import { patchMeSuccess } from './me'; -import type { AxiosError } from 'axios'; import type { Account } from 'soapbox/schemas'; import type { AppDispatch, RootState } from 'soapbox/store'; @@ -61,7 +60,7 @@ const fetchAliasesSuccess = (aliases: unknown[]) => ({ value: aliases, }); -const fetchAliasesFail = (error: AxiosError) => ({ +const fetchAliasesFail = (error: unknown) => ({ type: ALIASES_FETCH_FAIL, error, }); @@ -143,7 +142,7 @@ const addToAliasesSuccess = () => ({ type: ALIASES_ADD_SUCCESS, }); -const addToAliasesFail = (error: AxiosError) => ({ +const addToAliasesFail = (error: unknown) => ({ type: ALIASES_ADD_FAIL, error, }); @@ -196,7 +195,7 @@ const removeFromAliasesSuccess = () => ({ type: ALIASES_REMOVE_SUCCESS, }); -const removeFromAliasesFail = (error: AxiosError) => ({ +const removeFromAliasesFail = (error: unknown) => ({ type: ALIASES_REMOVE_FAIL, error, }); diff --git a/src/actions/announcements.ts b/src/actions/announcements.ts index 410de3cd9..de2d9fd4f 100644 --- a/src/actions/announcements.ts +++ b/src/actions/announcements.ts @@ -3,7 +3,6 @@ import { getFeatures } from 'soapbox/utils/features'; import { importFetchedStatuses } from './importer'; -import type { AxiosError } from 'axios'; import type { AppDispatch, RootState } from 'soapbox/store'; import type { APIEntity } from 'soapbox/types/entities'; @@ -61,7 +60,7 @@ export const fetchAnnouncementsSuccess = (announcements: APIEntity) => ({ skipLoading: true, }); -export const fetchAnnouncementsFail = (error: AxiosError) => ({ +export const fetchAnnouncementsFail = (error: unknown) => ({ type: ANNOUNCEMENTS_FETCH_FAIL, error, skipLoading: true, @@ -94,7 +93,7 @@ export const dismissAnnouncementSuccess = (announcementId: string) => ({ id: announcementId, }); -export const dismissAnnouncementFail = (announcementId: string, error: AxiosError) => ({ +export const dismissAnnouncementFail = (announcementId: string, error: unknown) => ({ type: ANNOUNCEMENTS_DISMISS_FAIL, id: announcementId, error, @@ -141,7 +140,7 @@ export const addReactionSuccess = (announcementId: string, name: string, already 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, id: announcementId, name, @@ -174,7 +173,7 @@ export const removeReactionSuccess = (announcementId: string, name: string) => ( 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, id: announcementId, name, diff --git a/src/actions/blocks.ts b/src/actions/blocks.ts index ef2f40359..58641b5c8 100644 --- a/src/actions/blocks.ts +++ b/src/actions/blocks.ts @@ -6,7 +6,6 @@ import api, { getLinks } from '../api'; import { fetchRelationships } from './accounts'; import { importFetchedAccounts } from './importer'; -import type { AxiosError } from 'axios'; import type { AppDispatch, RootState } from 'soapbox/store'; 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 { type: BLOCKS_FETCH_FAIL, error, @@ -90,7 +89,7 @@ function expandBlocksSuccess(accounts: any, next: any) { }; } -function expandBlocksFail(error: AxiosError) { +function expandBlocksFail(error: unknown) { return { type: BLOCKS_EXPAND_FAIL, error, diff --git a/src/actions/bookmarks.ts b/src/actions/bookmarks.ts index 090196e7b..da09edfa0 100644 --- a/src/actions/bookmarks.ts +++ b/src/actions/bookmarks.ts @@ -2,7 +2,6 @@ import api, { getLinks } from '../api'; import { importFetchedStatuses } from './importer'; -import type { AxiosError } from 'axios'; import type { AppDispatch, RootState } from 'soapbox/store'; import type { APIEntity } from 'soapbox/types/entities'; @@ -43,7 +42,7 @@ const fetchBookmarkedStatusesSuccess = (statuses: APIEntity[], next: string | nu next, }); -const fetchBookmarkedStatusesFail = (error: AxiosError) => ({ +const fetchBookmarkedStatusesFail = (error: unknown) => ({ type: BOOKMARKED_STATUSES_FETCH_FAIL, error, }); @@ -77,7 +76,7 @@ const expandBookmarkedStatusesSuccess = (statuses: APIEntity[], next: string | n next, }); -const expandBookmarkedStatusesFail = (error: AxiosError) => ({ +const expandBookmarkedStatusesFail = (error: unknown) => ({ type: BOOKMARKED_STATUSES_EXPAND_FAIL, error, }); diff --git a/src/actions/compose.ts b/src/actions/compose.ts index ea798aa1a..ed51f2a0c 100644 --- a/src/actions/compose.ts +++ b/src/actions/compose.ts @@ -1,4 +1,4 @@ -import axios, { AxiosError, Canceler } from 'axios'; +import axios, { Canceler } from 'axios'; import { List as ImmutableList } from 'immutable'; import throttle from 'lodash/throttle'; import { defineMessages, IntlShape } from 'react-intl'; @@ -388,7 +388,7 @@ const submitComposeSuccess = (composeId: string, status: APIEntity) => ({ status: status, }); -const submitComposeFail = (composeId: string, error: AxiosError) => ({ +const submitComposeFail = (composeId: string, error: unknown) => ({ type: COMPOSE_SUBMIT_FAIL, id: composeId, error: error, @@ -451,7 +451,7 @@ const uploadComposeSuccess = (composeId: string, media: APIEntity, file: File) = skipLoading: true, }); -const uploadComposeFail = (composeId: string, error: AxiosError | true) => ({ +const uploadComposeFail = (composeId: string, error: unknown) => ({ type: COMPOSE_UPLOAD_FAIL, id: composeId, error: error, @@ -484,7 +484,7 @@ const changeUploadComposeSuccess = (composeId: string, media: APIEntity) => ({ skipLoading: true, }); -const changeUploadComposeFail = (composeId: string, id: string, error: AxiosError) => ({ +const changeUploadComposeFail = (composeId: string, id: string, error: unknown) => ({ type: COMPOSE_UPLOAD_CHANGE_FAIL, composeId, id, diff --git a/src/actions/conversations.ts b/src/actions/conversations.ts index 73507e389..5c613e9e2 100644 --- a/src/actions/conversations.ts +++ b/src/actions/conversations.ts @@ -8,7 +8,6 @@ import { importFetchedStatus, } from './importer'; -import type { AxiosError } from 'axios'; import type { AppDispatch, RootState } from 'soapbox/store'; import type { APIEntity } from 'soapbox/types/entities'; @@ -76,7 +75,7 @@ const expandConversationsSuccess = (conversations: APIEntity[], next: string | n isLoadingRecent, }); -const expandConversationsFail = (error: AxiosError) => ({ +const expandConversationsFail = (error: unknown) => ({ type: CONVERSATIONS_FETCH_FAIL, error, }); diff --git a/src/actions/custom-emojis.ts b/src/actions/custom-emojis.ts index f6e14eea3..2baf5213a 100644 --- a/src/actions/custom-emojis.ts +++ b/src/actions/custom-emojis.ts @@ -1,6 +1,5 @@ import api from '../api'; -import type { AxiosError } from 'axios'; import type { AppDispatch, RootState } from 'soapbox/store'; import type { APIEntity } from 'soapbox/types/entities'; @@ -33,7 +32,7 @@ const fetchCustomEmojisSuccess = (custom_emojis: APIEntity[]) => ({ skipLoading: true, }); -const fetchCustomEmojisFail = (error: AxiosError) => ({ +const fetchCustomEmojisFail = (error: unknown) => ({ type: CUSTOM_EMOJIS_FETCH_FAIL, error, skipLoading: true, diff --git a/src/actions/directory.ts b/src/actions/directory.ts index 37ddcfdfa..3fd39f350 100644 --- a/src/actions/directory.ts +++ b/src/actions/directory.ts @@ -3,7 +3,6 @@ import api from '../api'; import { fetchRelationships } from './accounts'; import { importFetchedAccounts } from './importer'; -import type { AxiosError } from 'axios'; import type { AppDispatch, RootState } from 'soapbox/store'; import type { APIEntity } from 'soapbox/types/entities'; @@ -35,7 +34,7 @@ const fetchDirectorySuccess = (accounts: APIEntity[]) => ({ accounts, }); -const fetchDirectoryFail = (error: AxiosError) => ({ +const fetchDirectoryFail = (error: unknown) => ({ type: DIRECTORY_FETCH_FAIL, error, }); @@ -62,7 +61,7 @@ const expandDirectorySuccess = (accounts: APIEntity[]) => ({ accounts, }); -const expandDirectoryFail = (error: AxiosError) => ({ +const expandDirectoryFail = (error: unknown) => ({ type: DIRECTORY_EXPAND_FAIL, error, }); diff --git a/src/actions/domain-blocks.ts b/src/actions/domain-blocks.ts index d1b15561c..81a5d73bf 100644 --- a/src/actions/domain-blocks.ts +++ b/src/actions/domain-blocks.ts @@ -3,7 +3,6 @@ import { isLoggedIn } from 'soapbox/utils/auth'; import api, { getLinks } from '../api'; -import type { AxiosError } from 'axios'; import type { EntityStore } from 'soapbox/entity-store/types'; import type { Account } from 'soapbox/schemas'; import type { AppDispatch, RootState } from 'soapbox/store'; @@ -50,7 +49,7 @@ const blockDomainSuccess = (domain: string, accounts: string[]) => ({ accounts, }); -const blockDomainFail = (domain: string, error: AxiosError) => ({ +const blockDomainFail = (domain: string, error: unknown) => ({ type: DOMAIN_BLOCK_FAIL, domain, error, @@ -88,7 +87,7 @@ const unblockDomainSuccess = (domain: string, accounts: string[]) => ({ accounts, }); -const unblockDomainFail = (domain: string, error: AxiosError) => ({ +const unblockDomainFail = (domain: string, error: unknown) => ({ type: DOMAIN_UNBLOCK_FAIL, domain, error, @@ -118,7 +117,7 @@ const fetchDomainBlocksSuccess = (domains: string[], next: string | null) => ({ next, }); -const fetchDomainBlocksFail = (error: AxiosError) => ({ +const fetchDomainBlocksFail = (error: unknown) => ({ type: DOMAIN_BLOCKS_FETCH_FAIL, error, }); @@ -162,7 +161,7 @@ const expandDomainBlocksSuccess = (domains: string[], next: string | null) => ({ next, }); -const expandDomainBlocksFail = (error: AxiosError) => ({ +const expandDomainBlocksFail = (error: unknown) => ({ type: DOMAIN_BLOCKS_EXPAND_FAIL, error, }); diff --git a/src/actions/emoji-reacts.ts b/src/actions/emoji-reacts.ts index ce18e41c4..764ed0139 100644 --- a/src/actions/emoji-reacts.ts +++ b/src/actions/emoji-reacts.ts @@ -7,7 +7,6 @@ import api from '../api'; import { importFetchedAccounts, importFetchedStatus } from './importer'; import { favourite, unfavourite } from './interactions'; -import type { AxiosError } from 'axios'; import type { AppDispatch, RootState } from 'soapbox/store'; import type { APIEntity, Status } from 'soapbox/types/entities'; @@ -114,7 +113,7 @@ const fetchEmojiReactsSuccess = (id: string, emojiReacts: APIEntity[]) => ({ emojiReacts, }); -const fetchEmojiReactsFail = (id: string, error: AxiosError) => ({ +const fetchEmojiReactsFail = (id: string, error: unknown) => ({ type: EMOJI_REACTS_FETCH_FAIL, id, error, @@ -135,7 +134,7 @@ const emojiReactSuccess = (status: Status, emoji: string) => ({ skipLoading: true, }); -const emojiReactFail = (status: Status, emoji: string, error: AxiosError) => ({ +const emojiReactFail = (status: Status, emoji: string, error: unknown) => ({ type: EMOJI_REACT_FAIL, status, emoji, @@ -157,7 +156,7 @@ const unEmojiReactSuccess = (status: Status, emoji: string) => ({ skipLoading: true, }); -const unEmojiReactFail = (status: Status, emoji: string, error: AxiosError) => ({ +const unEmojiReactFail = (status: Status, emoji: string, error: unknown) => ({ type: UNEMOJI_REACT_FAIL, status, emoji, diff --git a/src/actions/events.ts b/src/actions/events.ts index ae291a185..875b487f6 100644 --- a/src/actions/events.ts +++ b/src/actions/events.ts @@ -12,7 +12,6 @@ import { STATUS_FETCH_SOURCE_SUCCESS, } from './statuses'; -import type { AxiosError } from 'axios'; import type { ReducerStatus } from 'soapbox/reducers/statuses'; import type { AppDispatch, RootState } from 'soapbox/store'; import type { APIEntity, Status as StatusEntity } from 'soapbox/types/entities'; @@ -184,7 +183,7 @@ const uploadEventBannerSuccess = (media: APIEntity, file: File) => ({ file, }); -const uploadEventBannerFail = (error: AxiosError | true) => ({ +const uploadEventBannerFail = (error: unknown) => ({ type: EVENT_BANNER_UPLOAD_FAIL, error, }); @@ -253,7 +252,7 @@ const submitEventSuccess = (status: APIEntity) => ({ status, }); -const submitEventFail = (error: AxiosError) => ({ +const submitEventFail = (error: unknown) => ({ type: EVENT_SUBMIT_FAIL, error, }); @@ -295,7 +294,7 @@ const joinEventSuccess = (status: APIEntity) => ({ 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, error, id: status.id, @@ -330,7 +329,7 @@ const leaveEventSuccess = (status: APIEntity) => ({ id: status.id, }); -const leaveEventFail = (error: AxiosError, status: StatusEntity) => ({ +const leaveEventFail = (error: unknown, status: StatusEntity) => ({ type: EVENT_LEAVE_FAIL, id: status.id, error, @@ -361,7 +360,7 @@ const fetchEventParticipationsSuccess = (id: string, accounts: APIEntity[], next next, }); -const fetchEventParticipationsFail = (id: string, error: AxiosError) => ({ +const fetchEventParticipationsFail = (id: string, error: unknown) => ({ type: EVENT_PARTICIPATIONS_FETCH_FAIL, id, error, @@ -398,7 +397,7 @@ const expandEventParticipationsSuccess = (id: string, accounts: APIEntity[], nex next, }); -const expandEventParticipationsFail = (id: string, error: AxiosError) => ({ +const expandEventParticipationsFail = (id: string, error: unknown) => ({ type: EVENT_PARTICIPATIONS_EXPAND_FAIL, id, error, @@ -429,7 +428,7 @@ const fetchEventParticipationRequestsSuccess = (id: string, participations: APIE next, }); -const fetchEventParticipationRequestsFail = (id: string, error: AxiosError) => ({ +const fetchEventParticipationRequestsFail = (id: string, error: unknown) => ({ type: EVENT_PARTICIPATION_REQUESTS_FETCH_FAIL, id, error, @@ -466,7 +465,7 @@ const expandEventParticipationRequestsSuccess = (id: string, participations: API next, }); -const expandEventParticipationRequestsFail = (id: string, error: AxiosError) => ({ +const expandEventParticipationRequestsFail = (id: string, error: unknown) => ({ type: EVENT_PARTICIPATION_REQUESTS_EXPAND_FAIL, id, error, @@ -497,7 +496,7 @@ const authorizeEventParticipationRequestSuccess = (id: string, accountId: string accountId, }); -const authorizeEventParticipationRequestFail = (id: string, accountId: string, error: AxiosError) => ({ +const authorizeEventParticipationRequestFail = (id: string, accountId: string, error: unknown) => ({ type: EVENT_PARTICIPATION_REQUEST_AUTHORIZE_FAIL, id, accountId, @@ -529,7 +528,7 @@ const rejectEventParticipationRequestSuccess = (id: string, accountId: string) = accountId, }); -const rejectEventParticipationRequestFail = (id: string, accountId: string, error: AxiosError) => ({ +const rejectEventParticipationRequestFail = (id: string, accountId: string, error: unknown) => ({ type: EVENT_PARTICIPATION_REQUEST_REJECT_FAIL, id, accountId, diff --git a/src/actions/favourites.ts b/src/actions/favourites.ts index da627ef73..cfd6e1f15 100644 --- a/src/actions/favourites.ts +++ b/src/actions/favourites.ts @@ -4,7 +4,6 @@ import api, { getLinks } from '../api'; import { importFetchedStatuses } from './importer'; -import type { AxiosError } from 'axios'; import type { AppDispatch, RootState } from 'soapbox/store'; import type { APIEntity } from 'soapbox/types/entities'; @@ -55,7 +54,7 @@ const fetchFavouritedStatusesSuccess = (statuses: APIEntity[], next: string | nu skipLoading: true, }); -const fetchFavouritedStatusesFail = (error: AxiosError) => ({ +const fetchFavouritedStatusesFail = (error: unknown) => ({ type: FAVOURITED_STATUSES_FETCH_FAIL, error, skipLoading: true, @@ -92,7 +91,7 @@ const expandFavouritedStatusesSuccess = (statuses: APIEntity[], next: string | n next, }); -const expandFavouritedStatusesFail = (error: AxiosError) => ({ +const expandFavouritedStatusesFail = (error: unknown) => ({ type: FAVOURITED_STATUSES_EXPAND_FAIL, error, }); @@ -130,7 +129,7 @@ const fetchAccountFavouritedStatusesSuccess = (accountId: string, statuses: APIE skipLoading: true, }); -const fetchAccountFavouritedStatusesFail = (accountId: string, error: AxiosError) => ({ +const fetchAccountFavouritedStatusesFail = (accountId: string, error: unknown) => ({ type: ACCOUNT_FAVOURITED_STATUSES_FETCH_FAIL, accountId, error, @@ -170,7 +169,7 @@ const expandAccountFavouritedStatusesSuccess = (accountId: string, statuses: API next, }); -const expandAccountFavouritedStatusesFail = (accountId: string, error: AxiosError) => ({ +const expandAccountFavouritedStatusesFail = (accountId: string, error: unknown) => ({ type: ACCOUNT_FAVOURITED_STATUSES_EXPAND_FAIL, accountId, error, diff --git a/src/actions/groups.ts b/src/actions/groups.ts index ad760d916..4fdb6c7d6 100644 --- a/src/actions/groups.ts +++ b/src/actions/groups.ts @@ -5,7 +5,6 @@ import api, { getLinks } from '../api'; import { fetchRelationships } from './accounts'; import { importFetchedGroups, importFetchedAccounts } from './importer'; -import type { AxiosError } from 'axios'; import type { GroupRole } from 'soapbox/reducers/group-memberships'; import type { AppDispatch, RootState } from 'soapbox/store'; import type { APIEntity } from 'soapbox/types/entities'; @@ -104,7 +103,7 @@ const deleteGroupSuccess = (id: string) => ({ id, }); -const deleteGroupFail = (id: string, error: AxiosError) => ({ +const deleteGroupFail = (id: string, error: unknown) => ({ type: GROUP_DELETE_FAIL, id, error, @@ -132,7 +131,7 @@ const fetchGroupSuccess = (group: APIEntity) => ({ group, }); -const fetchGroupFail = (id: string, error: AxiosError) => ({ +const fetchGroupFail = (id: string, error: unknown) => ({ type: GROUP_FETCH_FAIL, id, error, @@ -158,7 +157,7 @@ const fetchGroupsSuccess = (groups: APIEntity[]) => ({ groups, }); -const fetchGroupsFail = (error: AxiosError) => ({ +const fetchGroupsFail = (error: unknown) => ({ type: GROUPS_FETCH_FAIL, error, }); @@ -194,7 +193,7 @@ const fetchGroupRelationshipsSuccess = (relationships: APIEntity[]) => ({ skipLoading: true, }); -const fetchGroupRelationshipsFail = (error: AxiosError) => ({ +const fetchGroupRelationshipsFail = (error: unknown) => ({ type: GROUP_RELATIONSHIPS_FETCH_FAIL, error, skipLoading: true, @@ -222,7 +221,7 @@ const groupKickSuccess = (groupId: string, accountId: string) => ({ accountId, }); -const groupKickFail = (groupId: string, accountId: string, error: AxiosError) => ({ +const groupKickFail = (groupId: string, accountId: string, error: unknown) => ({ type: GROUP_KICK_SUCCESS, groupId, accountId, @@ -255,7 +254,7 @@ const fetchGroupBlocksSuccess = (id: string, accounts: APIEntity[], next: string next, }); -const fetchGroupBlocksFail = (id: string, error: AxiosError) => ({ +const fetchGroupBlocksFail = (id: string, error: unknown) => ({ type: GROUP_BLOCKS_FETCH_FAIL, id, error, @@ -295,7 +294,7 @@ const expandGroupBlocksSuccess = (id: string, accounts: APIEntity[], next: strin next, }); -const expandGroupBlocksFail = (id: string, error: AxiosError) => ({ +const expandGroupBlocksFail = (id: string, error: unknown) => ({ type: GROUP_BLOCKS_EXPAND_FAIL, id, error, @@ -322,7 +321,7 @@ const groupBlockSuccess = (groupId: string, accountId: string) => ({ accountId, }); -const groupBlockFail = (groupId: string, accountId: string, error: AxiosError) => ({ +const groupBlockFail = (groupId: string, accountId: string, error: unknown) => ({ type: GROUP_BLOCK_FAIL, groupId, accountId, @@ -350,7 +349,7 @@ const groupUnblockSuccess = (groupId: string, accountId: string) => ({ accountId, }); -const groupUnblockFail = (groupId: string, accountId: string, error: AxiosError) => ({ +const groupUnblockFail = (groupId: string, accountId: string, error: unknown) => ({ type: GROUP_UNBLOCK_FAIL, groupId, accountId, @@ -379,7 +378,7 @@ const groupPromoteAccountSuccess = (groupId: string, accountId: string, membersh memberships, }); -const groupPromoteAccountFail = (groupId: string, accountId: string, error: AxiosError) => ({ +const groupPromoteAccountFail = (groupId: string, accountId: string, error: unknown) => ({ type: GROUP_PROMOTE_FAIL, groupId, accountId, @@ -408,7 +407,7 @@ const groupDemoteAccountSuccess = (groupId: string, accountId: string, membershi memberships, }); -const groupDemoteAccountFail = (groupId: string, accountId: string, error: AxiosError) => ({ +const groupDemoteAccountFail = (groupId: string, accountId: string, error: unknown) => ({ type: GROUP_DEMOTE_FAIL, groupId, accountId, @@ -443,7 +442,7 @@ const fetchGroupMembershipsSuccess = (id: string, role: GroupRole, memberships: next, }); -const fetchGroupMembershipsFail = (id: string, role: GroupRole, error: AxiosError) => ({ +const fetchGroupMembershipsFail = (id: string, role: GroupRole, error: unknown) => ({ type: GROUP_MEMBERSHIPS_FETCH_FAIL, id, role, @@ -486,7 +485,7 @@ const expandGroupMembershipsSuccess = (id: string, role: GroupRole, memberships: next, }); -const expandGroupMembershipsFail = (id: string, role: GroupRole, error: AxiosError) => ({ +const expandGroupMembershipsFail = (id: string, role: GroupRole, error: unknown) => ({ type: GROUP_MEMBERSHIPS_EXPAND_FAIL, id, role, @@ -519,7 +518,7 @@ const fetchGroupMembershipRequestsSuccess = (id: string, accounts: APIEntity[], next, }); -const fetchGroupMembershipRequestsFail = (id: string, error: AxiosError) => ({ +const fetchGroupMembershipRequestsFail = (id: string, error: unknown) => ({ type: GROUP_MEMBERSHIP_REQUESTS_FETCH_FAIL, id, error, @@ -559,7 +558,7 @@ const expandGroupMembershipRequestsSuccess = (id: string, accounts: APIEntity[], next, }); -const expandGroupMembershipRequestsFail = (id: string, error: AxiosError) => ({ +const expandGroupMembershipRequestsFail = (id: string, error: unknown) => ({ type: GROUP_MEMBERSHIP_REQUESTS_EXPAND_FAIL, id, error, @@ -587,7 +586,7 @@ const authorizeGroupMembershipRequestSuccess = (groupId: string, accountId: stri accountId, }); -const authorizeGroupMembershipRequestFail = (groupId: string, accountId: string, error: AxiosError) => ({ +const authorizeGroupMembershipRequestFail = (groupId: string, accountId: string, error: unknown) => ({ type: GROUP_MEMBERSHIP_REQUEST_AUTHORIZE_FAIL, groupId, accountId, @@ -616,7 +615,7 @@ const rejectGroupMembershipRequestSuccess = (groupId: string, accountId: string) accountId, }); -const rejectGroupMembershipRequestFail = (groupId: string, accountId: string, error?: AxiosError) => ({ +const rejectGroupMembershipRequestFail = (groupId: string, accountId: string, error?: unknown) => ({ type: GROUP_MEMBERSHIP_REQUEST_REJECT_FAIL, groupId, accountId, diff --git a/src/actions/history.ts b/src/actions/history.ts index d38d94ee0..cf975cf42 100644 --- a/src/actions/history.ts +++ b/src/actions/history.ts @@ -2,7 +2,6 @@ import api from 'soapbox/api'; import { importFetchedAccounts } from './importer'; -import type { AxiosError } from 'axios'; import type { AppDispatch, RootState } from 'soapbox/store'; import type { APIEntity } from 'soapbox/types/entities'; @@ -37,7 +36,7 @@ const fetchHistorySuccess = (statusId: String, history: APIEntity[]) => ({ history, }); -const fetchHistoryFail = (error: AxiosError) => ({ +const fetchHistoryFail = (error: unknown) => ({ type: HISTORY_FETCH_FAIL, error, }); diff --git a/src/actions/interactions.ts b/src/actions/interactions.ts index 68a6d9cac..bfe63801c 100644 --- a/src/actions/interactions.ts +++ b/src/actions/interactions.ts @@ -9,7 +9,6 @@ import { fetchRelationships } from './accounts'; import { importFetchedAccounts, importFetchedStatus } from './importer'; import { expandGroupFeaturedTimeline } from './timelines'; -import type { AxiosError } from 'axios'; import type { AppDispatch, RootState } from 'soapbox/store'; import type { APIEntity, Group, Status as StatusEntity } from 'soapbox/types/entities'; @@ -135,7 +134,7 @@ const reblogSuccess = (status: StatusEntity) => ({ skipLoading: true, }); -const reblogFail = (status: StatusEntity, error: AxiosError) => ({ +const reblogFail = (status: StatusEntity, error: unknown) => ({ type: REBLOG_FAIL, status: status, error: error, @@ -154,7 +153,7 @@ const unreblogSuccess = (status: StatusEntity) => ({ skipLoading: true, }); -const unreblogFail = (status: StatusEntity, error: AxiosError) => ({ +const unreblogFail = (status: StatusEntity, error: unknown) => ({ type: UNREBLOG_FAIL, status: status, error: error, @@ -208,7 +207,7 @@ const favouriteSuccess = (status: StatusEntity) => ({ skipLoading: true, }); -const favouriteFail = (status: StatusEntity, error: AxiosError) => ({ +const favouriteFail = (status: StatusEntity, error: unknown) => ({ type: FAVOURITE_FAIL, status: status, error: error, @@ -227,7 +226,7 @@ const unfavouriteSuccess = (status: StatusEntity) => ({ skipLoading: true, }); -const unfavouriteFail = (status: StatusEntity, error: AxiosError) => ({ +const unfavouriteFail = (status: StatusEntity, error: unknown) => ({ type: UNFAVOURITE_FAIL, status: status, error: error, @@ -281,7 +280,7 @@ const dislikeSuccess = (status: StatusEntity) => ({ skipLoading: true, }); -const dislikeFail = (status: StatusEntity, error: AxiosError) => ({ +const dislikeFail = (status: StatusEntity, error: unknown) => ({ type: DISLIKE_FAIL, status: status, error: error, @@ -300,7 +299,7 @@ const undislikeSuccess = (status: StatusEntity) => ({ skipLoading: true, }); -const undislikeFail = (status: StatusEntity, error: AxiosError) => ({ +const undislikeFail = (status: StatusEntity, error: unknown) => ({ type: UNDISLIKE_FAIL, status: status, error: error, @@ -356,7 +355,7 @@ const bookmarkSuccess = (status: StatusEntity, response: APIEntity) => ({ response: response, }); -const bookmarkFail = (status: StatusEntity, error: AxiosError) => ({ +const bookmarkFail = (status: StatusEntity, error: unknown) => ({ type: BOOKMARK_FAIL, status: status, error: error, @@ -373,7 +372,7 @@ const unbookmarkSuccess = (status: StatusEntity, response: APIEntity) => ({ response: response, }); -const unbookmarkFail = (status: StatusEntity, error: AxiosError) => ({ +const unbookmarkFail = (status: StatusEntity, error: unknown) => ({ type: UNBOOKMARK_FAIL, status: status, error, @@ -407,7 +406,7 @@ const fetchReblogsSuccess = (id: string, accounts: APIEntity[], next: string | n next, }); -const fetchReblogsFail = (id: string, error: AxiosError) => ({ +const fetchReblogsFail = (id: string, error: unknown) => ({ type: REBLOGS_FETCH_FAIL, id, error, @@ -432,7 +431,7 @@ const expandReblogsSuccess = (id: string, accounts: APIEntity[], next: string | next, }); -const expandReblogsFail = (id: string, error: AxiosError) => ({ +const expandReblogsFail = (id: string, error: unknown) => ({ type: REBLOGS_EXPAND_FAIL, id, error, @@ -466,7 +465,7 @@ const fetchFavouritesSuccess = (id: string, accounts: APIEntity[], next: string next, }); -const fetchFavouritesFail = (id: string, error: AxiosError) => ({ +const fetchFavouritesFail = (id: string, error: unknown) => ({ type: FAVOURITES_FETCH_FAIL, id, error, @@ -491,7 +490,7 @@ const expandFavouritesSuccess = (id: string, accounts: APIEntity[], next: string next, }); -const expandFavouritesFail = (id: string, error: AxiosError) => ({ +const expandFavouritesFail = (id: string, error: unknown) => ({ type: FAVOURITES_EXPAND_FAIL, id, error, @@ -523,7 +522,7 @@ const fetchDislikesSuccess = (id: string, accounts: APIEntity[]) => ({ accounts, }); -const fetchDislikesFail = (id: string, error: AxiosError) => ({ +const fetchDislikesFail = (id: string, error: unknown) => ({ type: DISLIKES_FETCH_FAIL, id, error, @@ -552,7 +551,7 @@ const fetchReactionsSuccess = (id: string, reactions: APIEntity[]) => ({ reactions, }); -const fetchReactionsFail = (id: string, error: AxiosError) => ({ +const fetchReactionsFail = (id: string, error: unknown) => ({ type: REACTIONS_FETCH_FAIL, id, error, @@ -598,7 +597,7 @@ const pinSuccess = (status: StatusEntity) => ({ skipLoading: true, }); -const pinFail = (status: StatusEntity, error: AxiosError) => ({ +const pinFail = (status: StatusEntity, error: unknown) => ({ type: PIN_FAIL, status, error, @@ -640,7 +639,7 @@ const unpinSuccess = (status: StatusEntity) => ({ skipLoading: true, }); -const unpinFail = (status: StatusEntity, error: AxiosError) => ({ +const unpinFail = (status: StatusEntity, error: unknown) => ({ type: UNPIN_FAIL, status, error, @@ -676,7 +675,7 @@ const remoteInteractionSuccess = (ap_id: string, profile: string, url: string) = url, }); -const remoteInteractionFail = (ap_id: string, profile: string, error: AxiosError) => ({ +const remoteInteractionFail = (ap_id: string, profile: string, error: unknown) => ({ type: REMOTE_INTERACTION_FAIL, ap_id, profile, diff --git a/src/actions/lists.ts b/src/actions/lists.ts index 41d4c6fe1..e7c6604f9 100644 --- a/src/actions/lists.ts +++ b/src/actions/lists.ts @@ -6,7 +6,6 @@ import api from '../api'; import { importFetchedAccounts } from './importer'; -import type { AxiosError } from 'axios'; import type { AppDispatch, RootState } from 'soapbox/store'; import type { APIEntity } from 'soapbox/types/entities'; @@ -81,7 +80,7 @@ const fetchListSuccess = (list: APIEntity) => ({ list, }); -const fetchListFail = (id: string | number, error: AxiosError) => ({ +const fetchListFail = (id: string | number, error: unknown) => ({ type: LIST_FETCH_FAIL, id, error, @@ -106,7 +105,7 @@ const fetchListsSuccess = (lists: APIEntity[]) => ({ lists, }); -const fetchListsFail = (error: AxiosError) => ({ +const fetchListsFail = (error: unknown) => ({ type: LISTS_FETCH_FAIL, error, }); @@ -159,7 +158,7 @@ const createListSuccess = (list: APIEntity) => ({ list, }); -const createListFail = (error: AxiosError) => ({ +const createListFail = (error: unknown) => ({ type: LIST_CREATE_FAIL, error, }); @@ -188,7 +187,7 @@ const updateListSuccess = (list: APIEntity) => ({ list, }); -const updateListFail = (id: string | number, error: AxiosError) => ({ +const updateListFail = (id: string | number, error: unknown) => ({ type: LIST_UPDATE_FAIL, id, error, @@ -218,7 +217,7 @@ const deleteListSuccess = (id: string | number) => ({ id, }); -const deleteListFail = (id: string | number, error: AxiosError) => ({ +const deleteListFail = (id: string | number, error: unknown) => ({ type: LIST_DELETE_FAIL, id, error, @@ -247,7 +246,7 @@ const fetchListAccountsSuccess = (id: string | number, accounts: APIEntity[], ne next, }); -const fetchListAccountsFail = (id: string | number, error: AxiosError) => ({ +const fetchListAccountsFail = (id: string | number, error: unknown) => ({ type: LIST_ACCOUNTS_FETCH_FAIL, id, error, @@ -343,7 +342,7 @@ const removeFromListSuccess = (listId: string | number, accountId: string) => ({ accountId, }); -const removeFromListFail = (listId: string | number, accountId: string, error: AxiosError) => ({ +const removeFromListFail = (listId: string | number, accountId: string, error: unknown) => ({ type: LIST_EDITOR_REMOVE_FAIL, listId, accountId, @@ -384,7 +383,7 @@ const fetchAccountListsSuccess = (id: string, lists: APIEntity[]) => ({ lists, }); -const fetchAccountListsFail = (id: string, err: AxiosError) => ({ +const fetchAccountListsFail = (id: string, err: unknown) => ({ type: LIST_ADDER_LISTS_FETCH_FAIL, id, err, diff --git a/src/actions/me.ts b/src/actions/me.ts index dc6c8fa2d..7be77c52f 100644 --- a/src/actions/me.ts +++ b/src/actions/me.ts @@ -8,7 +8,7 @@ import api from '../api'; import { loadCredentials } from './auth'; import { importFetchedAccount } from './importer'; -import type { AxiosError, RawAxiosRequestHeaders } from 'axios'; +import type { RawAxiosRequestHeaders } from 'axios'; import type { Account } from 'soapbox/schemas'; import type { AppDispatch, RootState } from 'soapbox/store'; import type { APIEntity } from 'soapbox/types/entities'; @@ -125,7 +125,7 @@ const patchMeSuccess = (me: APIEntity) => dispatch(action); }; -const patchMeFail = (error: AxiosError) => ({ +const patchMeFail = (error: unknown) => ({ type: ME_PATCH_FAIL, error, skipAlert: true, diff --git a/src/actions/media.ts b/src/actions/media.ts index ed8d25fa0..acb48a9e5 100644 --- a/src/actions/media.ts +++ b/src/actions/media.ts @@ -8,7 +8,6 @@ import resizeImage from 'soapbox/utils/resize-image'; import api from '../api'; -import type { AxiosError } from 'axios'; import type { AppDispatch, RootState } from 'soapbox/store'; import type { APIEntity } from 'soapbox/types/entities'; @@ -59,7 +58,7 @@ const uploadFile = ( file: File, intl: IntlShape, onSuccess: (data: APIEntity) => void = () => {}, - onFail: (error: AxiosError | true) => void = () => {}, + onFail: (error: unknown) => void = () => {}, onProgress: (loaded: number) => void = () => {}, changeTotal: (value: number) => void = () => {}, ) => diff --git a/src/actions/mfa.ts b/src/actions/mfa.ts index 4c1e85832..e4c51203d 100644 --- a/src/actions/mfa.ts +++ b/src/actions/mfa.ts @@ -1,6 +1,5 @@ import api from '../api'; -import type { AxiosError } from 'axios'; import type { AppDispatch, RootState } from 'soapbox/store'; 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 }) => { dispatch({ type: MFA_SETUP_SUCCESS, data }); return data; - }).catch((error: AxiosError) => { + }).catch((error: unknown) => { dispatch({ type: MFA_SETUP_FAIL }); 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 }) => { dispatch({ type: MFA_CONFIRM_SUCCESS, method, code }); return data; - }).catch((error: AxiosError) => { + }).catch((error: unknown) => { dispatch({ type: MFA_CONFIRM_FAIL, method, code, error, skipAlert: true }); 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 }) => { dispatch({ type: MFA_DISABLE_SUCCESS, method }); return data; - }).catch((error: AxiosError) => { + }).catch((error: unknown) => { dispatch({ type: MFA_DISABLE_FAIL, method, skipAlert: true }); throw error; }); diff --git a/src/actions/notifications.ts b/src/actions/notifications.ts index a7c2f11f6..c6ce8043a 100644 --- a/src/actions/notifications.ts +++ b/src/actions/notifications.ts @@ -22,7 +22,6 @@ import { import { saveMarker } from './markers'; import { getSettings, saveSettings } from './settings'; -import type { AxiosError } from 'axios'; import type { AppDispatch, RootState } from 'soapbox/store'; import type { APIEntity, Status } from 'soapbox/types/entities'; @@ -262,7 +261,7 @@ const expandNotificationsSuccess = (notifications: APIEntity[], next: string | n skipLoading: !isLoadingMore, }); -const expandNotificationsFail = (error: AxiosError, isLoadingMore: boolean) => ({ +const expandNotificationsFail = (error: unknown, isLoadingMore: boolean) => ({ type: NOTIFICATIONS_EXPAND_FAIL, error, skipLoading: !isLoadingMore, diff --git a/src/actions/patron.ts b/src/actions/patron.ts index f2ecca5d1..0e164462f 100644 --- a/src/actions/patron.ts +++ b/src/actions/patron.ts @@ -1,6 +1,5 @@ import api from '../api'; -import type { AxiosError } from 'axios'; import type { AppDispatch, RootState } from 'soapbox/store'; import type { APIEntity } from 'soapbox/types/entities'; @@ -38,7 +37,7 @@ const importFetchedInstance = (instance: APIEntity) => ({ instance, }); -const fetchInstanceFail = (error: AxiosError) => ({ +const fetchInstanceFail = (error: unknown) => ({ type: PATRON_INSTANCE_FETCH_FAIL, error, skipAlert: true, @@ -49,7 +48,7 @@ const importFetchedAccount = (account: APIEntity) => ({ account, }); -const fetchAccountFail = (error: AxiosError) => ({ +const fetchAccountFail = (error: unknown) => ({ type: PATRON_ACCOUNT_FETCH_FAIL, error, skipAlert: true, diff --git a/src/actions/pin-statuses.ts b/src/actions/pin-statuses.ts index dacf502c2..c2a5115cd 100644 --- a/src/actions/pin-statuses.ts +++ b/src/actions/pin-statuses.ts @@ -4,7 +4,6 @@ import api from '../api'; import { importFetchedStatuses } from './importer'; -import type { AxiosError } from 'axios'; import type { AppDispatch, RootState } from 'soapbox/store'; import type { APIEntity } from 'soapbox/types/entities'; @@ -37,7 +36,7 @@ const fetchPinnedStatusesSuccess = (statuses: APIEntity[], next: string | null) next, }); -const fetchPinnedStatusesFail = (error: AxiosError) => ({ +const fetchPinnedStatusesFail = (error: unknown) => ({ type: PINNED_STATUSES_FETCH_FAIL, error, }); diff --git a/src/actions/polls.ts b/src/actions/polls.ts index da4579f71..64fb65320 100644 --- a/src/actions/polls.ts +++ b/src/actions/polls.ts @@ -2,7 +2,6 @@ import api from '../api'; import { importFetchedPoll } from './importer'; -import type { AxiosError } from 'axios'; import type { AppDispatch, RootState } from 'soapbox/store'; import type { APIEntity } from 'soapbox/types/entities'; @@ -47,7 +46,7 @@ const voteSuccess = (poll: APIEntity) => ({ poll, }); -const voteFail = (error: AxiosError) => ({ +const voteFail = (error: unknown) => ({ type: POLL_VOTE_FAIL, error, }); @@ -61,7 +60,7 @@ const fetchPollSuccess = (poll: APIEntity) => ({ poll, }); -const fetchPollFail = (error: AxiosError) => ({ +const fetchPollFail = (error: unknown) => ({ type: POLL_FETCH_FAIL, error, }); diff --git a/src/actions/reports.ts b/src/actions/reports.ts index 4ad65a21e..662b24b3d 100644 --- a/src/actions/reports.ts +++ b/src/actions/reports.ts @@ -2,7 +2,6 @@ import api from '../api'; import { openModal } from './modals'; -import type { AxiosError } from 'axios'; import type { Account } from 'soapbox/schemas'; import type { AppDispatch, RootState } from 'soapbox/store'; import type { ChatMessage, Group, Status } from 'soapbox/types/entities'; @@ -83,7 +82,7 @@ const submitReportSuccess = () => ({ type: REPORT_SUBMIT_SUCCESS, }); -const submitReportFail = (error: AxiosError) => ({ +const submitReportFail = (error: unknown) => ({ type: REPORT_SUBMIT_FAIL, error, }); diff --git a/src/actions/scheduled-statuses.ts b/src/actions/scheduled-statuses.ts index 33e763701..b7cf112e9 100644 --- a/src/actions/scheduled-statuses.ts +++ b/src/actions/scheduled-statuses.ts @@ -2,7 +2,6 @@ import { getFeatures } from 'soapbox/utils/features'; import api, { getLinks } from '../api'; -import type { AxiosError } from 'axios'; import type { AppDispatch, RootState } from 'soapbox/store'; import type { APIEntity } from 'soapbox/types/entities'; @@ -61,7 +60,7 @@ const fetchScheduledStatusesSuccess = (statuses: APIEntity[], next: string | nul next, }); -const fetchScheduledStatusesFail = (error: AxiosError) => ({ +const fetchScheduledStatusesFail = (error: unknown) => ({ type: SCHEDULED_STATUSES_FETCH_FAIL, error, }); @@ -94,7 +93,7 @@ const expandScheduledStatusesSuccess = (statuses: APIEntity[], next: string | nu next, }); -const expandScheduledStatusesFail = (error: AxiosError) => ({ +const expandScheduledStatusesFail = (error: unknown) => ({ type: SCHEDULED_STATUSES_EXPAND_FAIL, error, }); diff --git a/src/actions/search.ts b/src/actions/search.ts index 2b4c8f4e9..7031173c4 100644 --- a/src/actions/search.ts +++ b/src/actions/search.ts @@ -3,7 +3,6 @@ import api, { getLinks } from '../api'; import { fetchRelationships } from './accounts'; import { importFetchedAccounts, importFetchedStatuses } from './importer'; -import type { AxiosError } from 'axios'; import type { SearchFilter } from 'soapbox/reducers/search'; import type { AppDispatch, RootState } from 'soapbox/store'; import type { APIEntity } from 'soapbox/types/entities'; @@ -105,7 +104,7 @@ const fetchSearchSuccess = (results: APIEntity[], searchTerm: string, searchType next, }); -const fetchSearchFail = (error: AxiosError) => ({ +const fetchSearchFail = (error: unknown) => ({ type: SEARCH_FETCH_FAIL, error, }); @@ -178,7 +177,7 @@ const expandSearchSuccess = (results: APIEntity[], searchTerm: string, searchTyp next, }); -const expandSearchFail = (error: AxiosError) => ({ +const expandSearchFail = (error: unknown) => ({ type: SEARCH_EXPAND_FAIL, error, }); diff --git a/src/actions/soapbox.ts b/src/actions/soapbox.ts index 790997199..788775c00 100644 --- a/src/actions/soapbox.ts +++ b/src/actions/soapbox.ts @@ -8,7 +8,6 @@ import { getFeatures } from 'soapbox/utils/features'; import api, { staticClient } from '../api'; -import type { AxiosError } from 'axios'; import type { AppDispatch, RootState } from 'soapbox/store'; 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, error, skipAlert: true, diff --git a/src/actions/tags.ts b/src/actions/tags.ts index 75d8e00fa..ee3289570 100644 --- a/src/actions/tags.ts +++ b/src/actions/tags.ts @@ -1,6 +1,5 @@ import api, { getLinks } from '../api'; -import type { AxiosError } from 'axios'; import type { AppDispatch, RootState } from 'soapbox/store'; import type { APIEntity } from 'soapbox/types/entities'; @@ -44,7 +43,7 @@ const fetchHashtagSuccess = (name: string, tag: APIEntity) => ({ tag, }); -const fetchHashtagFail = (error: AxiosError) => ({ +const fetchHashtagFail = (error: unknown) => ({ type: HASHTAG_FETCH_FAIL, error, }); @@ -70,7 +69,7 @@ const followHashtagSuccess = (name: string, tag: APIEntity) => ({ tag, }); -const followHashtagFail = (name: string, error: AxiosError) => ({ +const followHashtagFail = (name: string, error: unknown) => ({ type: HASHTAG_FOLLOW_FAIL, name, error, @@ -97,7 +96,7 @@ const unfollowHashtagSuccess = (name: string, tag: APIEntity) => ({ tag, }); -const unfollowHashtagFail = (name: string, error: AxiosError) => ({ +const unfollowHashtagFail = (name: string, error: unknown) => ({ type: HASHTAG_UNFOLLOW_FAIL, name, error, @@ -124,7 +123,7 @@ const fetchFollowedHashtagsSuccess = (followed_tags: APIEntity[], next: string | next, }); -const fetchFollowedHashtagsFail = (error: AxiosError) => ({ +const fetchFollowedHashtagsFail = (error: unknown) => ({ type: FOLLOWED_HASHTAGS_FETCH_FAIL, error, }); @@ -156,7 +155,7 @@ const expandFollowedHashtagsSuccess = (followed_tags: APIEntity[], next: string next, }); -const expandFollowedHashtagsFail = (error: AxiosError) => ({ +const expandFollowedHashtagsFail = (error: unknown) => ({ type: FOLLOWED_HASHTAGS_EXPAND_FAIL, error, }); diff --git a/src/actions/timelines.ts b/src/actions/timelines.ts index 03198652f..35f0f5638 100644 --- a/src/actions/timelines.ts +++ b/src/actions/timelines.ts @@ -9,7 +9,6 @@ import api, { getNextLink, getPrevLink } from '../api'; import { fetchGroupRelationships } from './groups'; import { importFetchedStatus, importFetchedStatuses } from './importer'; -import type { AxiosError } from 'axios'; import type { AppDispatch, RootState } from 'soapbox/store'; import type { APIEntity, Status } from 'soapbox/types/entities'; @@ -284,7 +283,7 @@ const expandTimelineSuccess = ( skipLoading: !isLoadingMore, }); -const expandTimelineFail = (timeline: string, error: AxiosError, isLoadingMore: boolean) => ({ +const expandTimelineFail = (timeline: string, error: unknown, isLoadingMore: boolean) => ({ type: TIMELINE_EXPAND_FAIL, timeline, error, diff --git a/src/actions/trends.ts b/src/actions/trends.ts index dc45a5c38..6eeb32c38 100644 --- a/src/actions/trends.ts +++ b/src/actions/trends.ts @@ -1,6 +1,5 @@ import api from '../api'; -import type { AxiosError } from 'axios'; import type { AppDispatch, RootState } from 'soapbox/store'; import type { APIEntity } from 'soapbox/types/entities'; @@ -28,7 +27,7 @@ const fetchTrendsSuccess = (tags: APIEntity[]) => ({ skipLoading: true, }); -const fetchTrendsFail = (error: AxiosError) => ({ +const fetchTrendsFail = (error: unknown) => ({ type: TRENDS_FETCH_FAIL, error, skipLoading: true, diff --git a/src/features/ui/components/modals/report-modal/report-modal.tsx b/src/features/ui/components/modals/report-modal/report-modal.tsx index 0c1a86ce5..91cbaa0a4 100644 --- a/src/features/ui/components/modals/report-modal/report-modal.tsx +++ b/src/features/ui/components/modals/report-modal/report-modal.tsx @@ -17,8 +17,6 @@ import ConfirmationStep from './steps/confirmation-step'; import OtherActionsStep from './steps/other-actions-step'; import ReasonStep from './steps/reason-step'; -import type { AxiosError } from 'axios'; - const messages = defineMessages({ blankslate: { id: 'report.reason.blankslate', defaultMessage: 'You have removed all statuses from being selected.' }, done: { id: 'report.done', defaultMessage: 'Done' }, @@ -123,7 +121,7 @@ const ReportModal = ({ onClose }: IReportModal) => { const handleSubmit = () => { dispatch(submitReport()) .then(() => setCurrentStep(Steps.THREE)) - .catch((error: AxiosError) => dispatch(submitReportFail(error))); + .catch((error) => dispatch(submitReportFail(error))); if (isBlocked && account) { dispatch(blockAccount(account.id)); diff --git a/src/queries/relationships.ts b/src/queries/relationships.ts index e4b8d1188..3ce486aac 100644 --- a/src/queries/relationships.ts +++ b/src/queries/relationships.ts @@ -1,5 +1,4 @@ import { useMutation } from '@tanstack/react-query'; -import { AxiosError } from 'axios'; import { fetchRelationshipsFail, fetchRelationshipsSuccess } from 'soapbox/actions/accounts'; import { useApi, useAppDispatch } from 'soapbox/hooks'; @@ -17,7 +16,7 @@ const useFetchRelationships = () => { onSuccess(response) { dispatch(fetchRelationshipsSuccess(response.data)); }, - onError(error: AxiosError) { + onError(error) { dispatch(fetchRelationshipsFail(error)); }, });