Replace getAgent() with reading agent (#4243)
* Replace getAgent() with agent
* Replace {agent} with agent
This commit is contained in:
parent
8a2f43c218
commit
9bd411c151
74 changed files with 400 additions and 438 deletions
|
|
@ -8,12 +8,12 @@ const RQKEY_ROOT = 'app-passwords'
|
|||
export const RQKEY = () => [RQKEY_ROOT]
|
||||
|
||||
export function useAppPasswordsQuery() {
|
||||
const {getAgent} = useAgent()
|
||||
const agent = useAgent()
|
||||
return useQuery({
|
||||
staleTime: STALE.MINUTES.FIVE,
|
||||
queryKey: RQKEY(),
|
||||
queryFn: async () => {
|
||||
const res = await getAgent().com.atproto.server.listAppPasswords({})
|
||||
const res = await agent.com.atproto.server.listAppPasswords({})
|
||||
return res.data.passwords
|
||||
},
|
||||
})
|
||||
|
|
@ -21,7 +21,7 @@ export function useAppPasswordsQuery() {
|
|||
|
||||
export function useAppPasswordCreateMutation() {
|
||||
const queryClient = useQueryClient()
|
||||
const {getAgent} = useAgent()
|
||||
const agent = useAgent()
|
||||
return useMutation<
|
||||
ComAtprotoServerCreateAppPassword.OutputSchema,
|
||||
Error,
|
||||
|
|
@ -29,7 +29,7 @@ export function useAppPasswordCreateMutation() {
|
|||
>({
|
||||
mutationFn: async ({name, privileged}) => {
|
||||
return (
|
||||
await getAgent().com.atproto.server.createAppPassword({
|
||||
await agent.com.atproto.server.createAppPassword({
|
||||
name,
|
||||
privileged,
|
||||
})
|
||||
|
|
@ -45,10 +45,10 @@ export function useAppPasswordCreateMutation() {
|
|||
|
||||
export function useAppPasswordDeleteMutation() {
|
||||
const queryClient = useQueryClient()
|
||||
const {getAgent} = useAgent()
|
||||
const agent = useAgent()
|
||||
return useMutation<void, Error, {name: string}>({
|
||||
mutationFn: async ({name}) => {
|
||||
await getAgent().com.atproto.server.revokeAppPassword({
|
||||
await agent.com.atproto.server.revokeAppPassword({
|
||||
name,
|
||||
})
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue