@@ -20,14 +20,15 @@ import { BiSolidBookmarkAlt } from "react-icons/bi";
2020import { BiPlus } from "react-icons/bi" ;
2121import { BiSolidHeart } from "react-icons/bi" ;
2222import Link from "next/link" ;
23- import { getAgentFromClient } from "@/lib/api/bsky /agent" ;
23+ import { useAgent } from "@/app/providers /agent" ;
2424
2525interface Props {
2626 feed : string ;
2727}
2828
2929export default function FeedHeader ( props : Props ) {
3030 const { feed } = props ;
31+ const agent = useAgent ( ) ;
3132 const router = useRouter ( ) ;
3233 const [ isSaved , setIsSaved ] = useState < boolean | null > ( null ) ;
3334 const [ isPinned , setIsPinned ] = useState < boolean | null > ( null ) ;
@@ -55,7 +56,6 @@ export default function FeedHeader(props: Props) {
5556 const toggleSave = async ( ) => {
5657 setIsSaved ( ( prev ) => ! prev ) ;
5758 try {
58- const agent = await getAgentFromClient ( ) ;
5959 const response = await toggleSaveFeed ( agent , feed ) ;
6060 if ( ! response . success ) {
6161 setIsSaved ( ( prev ) => ! prev ) ;
@@ -71,7 +71,6 @@ export default function FeedHeader(props: Props) {
7171 const togglePin = async ( ) => {
7272 setIsPinned ( ( prev ) => ! prev ) ;
7373 try {
74- const agent = await getAgentFromClient ( ) ;
7574 const response = await togglePinFeed ( agent , feed ) ;
7675 if ( ! response . success ) {
7776 setIsPinned ( ( prev ) => ! prev ) ;
@@ -85,7 +84,6 @@ export default function FeedHeader(props: Props) {
8584 } ;
8685
8786 const toggleLike = async ( ) => {
88- const agent = await getAgentFromClient ( ) ;
8987 setIsLiked ( ( prev ) => ! prev ) ;
9088 if ( ! likeUri && feedInfo ) {
9189 try {
0 commit comments