Replace getAgent() with reading agent (#4243)

* Replace getAgent() with agent

* Replace {agent} with agent
This commit is contained in:
dan
2024-05-28 16:37:51 +01:00
committed by GitHub
parent 8a2f43c218
commit 9bd411c151
74 changed files with 400 additions and 438 deletions
+6 -6
View File
@@ -40,7 +40,7 @@ export interface ListMembersip {
*/
export function useDangerousListMembershipsQuery() {
const {currentAccount} = useSession()
const {getAgent} = useAgent()
const agent = useAgent()
return useQuery<ListMembersip[]>({
staleTime: STALE.MINUTES.FIVE,
queryKey: RQKEY(),
@@ -51,7 +51,7 @@ export function useDangerousListMembershipsQuery() {
let cursor
let arr: ListMembersip[] = []
for (let i = 0; i < SANITY_PAGE_LIMIT; i++) {
const res = await getAgent().app.bsky.graph.listitem.list({
const res = await agent.app.bsky.graph.listitem.list({
repo: currentAccount.did,
limit: PAGE_SIZE,
cursor,
@@ -92,7 +92,7 @@ export function getMembership(
export function useListMembershipAddMutation() {
const {currentAccount} = useSession()
const {getAgent} = useAgent()
const agent = useAgent()
const queryClient = useQueryClient()
return useMutation<
{uri: string; cid: string},
@@ -103,7 +103,7 @@ export function useListMembershipAddMutation() {
if (!currentAccount) {
throw new Error('Not logged in')
}
const res = await getAgent().app.bsky.graph.listitem.create(
const res = await agent.app.bsky.graph.listitem.create(
{repo: currentAccount.did},
{
subject: actorDid,
@@ -151,7 +151,7 @@ export function useListMembershipAddMutation() {
export function useListMembershipRemoveMutation() {
const {currentAccount} = useSession()
const {getAgent} = useAgent()
const agent = useAgent()
const queryClient = useQueryClient()
return useMutation<
void,
@@ -163,7 +163,7 @@ export function useListMembershipRemoveMutation() {
throw new Error('Not logged in')
}
const membershipUrip = new AtUri(membershipUri)
await getAgent().app.bsky.graph.listitem.delete({
await agent.app.bsky.graph.listitem.delete({
repo: currentAccount.did,
rkey: membershipUrip.rkey,
})