Replace getAgent() with reading agent (#4243)
* Replace getAgent() with agent
* Replace {agent} with agent
This commit is contained in:
@@ -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,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user