diff --git a/src/components/PostControls/BookmarkButton.tsx b/src/components/PostControls/BookmarkButton.tsx index 558f4fcc6c..c32b660804 100644 --- a/src/components/PostControls/BookmarkButton.tsx +++ b/src/components/PostControls/BookmarkButton.tsx @@ -9,6 +9,7 @@ import {type Shadow} from '#/state/cache/post-shadow' import {useBookmarkMutation} from '#/state/queries/bookmarks/useBookmarkMutation' import {useTheme} from '#/alf' import {Bookmark, BookmarkFilled} from '#/components/icons/Bookmark' +import * as toast from '#/components/Toast' import {PostControlButton, PostControlButtonIcon} from './PostControlButton' export const BookmarkButton = memo(function BookmarkButton({ @@ -33,21 +34,24 @@ export const BookmarkButton = memo(function BookmarkButton({ action: 'delete', uri, }) - // TODO toast + toast.show(_(msg`Removed from saved posts`)) } else { await bookmark({ action: 'create', uri, cid, }) - // TODO toast + toast.show(_(msg`Post saved`), { + type: 'success', + }) } - } catch (e) { + } catch (e: any) { const {raw, clean} = cleanError(e) - console.log(clean || raw || e) - // TODO toast + toast.show(clean || raw || e, { + type: 'error', + }) } - }, [uri, cid, isBookmarked, bookmark, cleanError]) + }, [_, uri, cid, isBookmarked, bookmark, cleanError]) return ( @@ -114,7 +115,6 @@ function BookmarksInner() { const onEndReached = useCallback(async () => { if (isFetchingNextPage || !hasNextPage || error) return try { - console.log('Fetching more bookmarks...') await fetchNextPage() } catch {} }, [isFetchingNextPage, hasNextPage, error, fetchNextPage]) @@ -220,10 +220,11 @@ function BookmarkNotFound({ try { setRemoved(true) await bookmark({action: 'delete', uri: post.uri}) - } catch (e) { + } catch (e: any) { const {raw, clean} = cleanError(e) - console.log(clean || raw || e) - // TODO toast + toast.show(clean || raw || e, { + type: 'error', + }) } }, [post.uri, bookmark, cleanError]) @@ -260,7 +261,7 @@ function BookmarkNotFound({