Bluesky app fork with some witchin' additions 💫

require auth for bookmarks (#8983)

authored by samuel.fm and committed by

GitHub 91725671 c26906e1

+10 -7
+10 -7
src/components/PostControls/BookmarkButton.tsx
··· 9 9 import {logger} from '#/logger' 10 10 import {type Shadow} from '#/state/cache/post-shadow' 11 11 import {useBookmarkMutation} from '#/state/queries/bookmarks/useBookmarkMutation' 12 + import {useRequireAuth} from '#/state/session' 12 13 import {useTheme} from '#/alf' 13 14 import {Bookmark, BookmarkFilled} from '#/components/icons/Bookmark' 14 15 import {Trash_Stroke2_Corner0_Rounded as TrashIcon} from '#/components/icons/Trash' ··· 30 31 const {_} = useLingui() 31 32 const {mutateAsync: bookmark} = useBookmarkMutation() 32 33 const cleanError = useCleanError() 34 + const requireAuth = useRequireAuth() 33 35 34 36 const {viewer} = post 35 37 const isBookmarked = !!viewer?.bookmarked ··· 108 110 } 109 111 } 110 112 111 - const onHandlePress = async () => { 112 - if (isBookmarked) { 113 - await remove() 114 - } else { 115 - await save() 116 - } 117 - } 113 + const onHandlePress = () => 114 + requireAuth(async () => { 115 + if (isBookmarked) { 116 + await remove() 117 + } else { 118 + await save() 119 + } 120 + }) 118 121 119 122 return ( 120 123 <PostControlButton