interface FollowContextValue

Provided by FollowProvider through FollowContext. The four functions change the sets at once and undo the change when the request fails. They resolve to whether it worked, and never reject.

Properties

followedUserIds: Set<string>
followUser: (userId: string) => Promise<boolean>
unfollowUser: (userId: string) => Promise<boolean>
followPlaylist: (playlistId: string) => Promise<boolean>
unfollowPlaylist: (playlistId: string) => Promise<boolean>
isLoaded: boolean

False until the follows are fetched, and always for a visitor. The sets are empty until then, so a button would show "Follow" for a followed user. A failed fetch keeps it false, and is tried again 10 s later.

Usage

import { type FollowContextValue } from "src/contexts/social/FollowContext.ts";