Migrate to new plural APIs

This commit is contained in:
Eric Bailey
2024-04-23 18:07:36 -05:00
parent afadfb6be6
commit 6d9fc23674
10 changed files with 77 additions and 69 deletions
+11 -9
View File
@@ -8,7 +8,7 @@ import {useLingui} from '@lingui/react'
import {logger} from '#/logger'
import {FeedSourceInfo, useFeedSourceInfoQuery} from '#/state/queries/feed'
import {
useAddSavedFeedMutation,
useAddSavedFeedsMutation,
usePreferencesQuery,
UsePreferencesQueryResponse,
useRemoveFeedMutation,
@@ -89,8 +89,8 @@ export function FeedSourceCardLoaded({
const removePromptControl = Prompt.usePromptControl()
const navigation = useNavigationDeduped()
const {isPending: isAddSavedFeedPending, mutateAsync: addSavedFeed} =
useAddSavedFeedMutation()
const {isPending: isAddSavedFeedPending, mutateAsync: addSavedFeeds} =
useAddSavedFeedsMutation()
const {isPending: isRemovePending, mutateAsync: removeFeed} =
useRemoveFeedMutation()
@@ -103,17 +103,19 @@ export function FeedSourceCardLoaded({
if (!feed) return
try {
await addSavedFeed({
type: 'feed',
value: feed.uri,
pinned: pinOnSave,
})
await addSavedFeeds([
{
type: 'feed',
value: feed.uri,
pinned: pinOnSave,
},
])
Toast.show(_(msg`Added to my feeds`))
} catch (e) {
Toast.show(_(msg`There was an issue contacting your server`))
logger.error('Failed to save feed', {message: e})
}
}, [_, feed, pinOnSave, addSavedFeed])
}, [_, feed, pinOnSave, addSavedFeeds])
const onUnsave = React.useCallback(async () => {
if (!savedFeedConfig) return