Skip to content

Commit

Permalink
do It (#305)
Browse files Browse the repository at this point in the history
  • Loading branch information
guibescos authored Dec 15, 2023
1 parent 3b16426 commit ff8e6be
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion frontend/hooks/useJoinDaoLlcMutation.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { StakeAccount, StakeConnection } from '@pythnetwork/staking'
import toast from 'react-hot-toast'
import { useMutation } from 'react-query'
import { useMutation, useQueryClient } from 'react-query'
import { StakeConnectionQueryKey } from './useStakeConnection'

export function useJoinDaoLlcMutation() {
const queryClient = useQueryClient()

return useMutation(
['sign-llc-mutation'],
async ({
Expand All @@ -16,6 +19,13 @@ export function useJoinDaoLlcMutation() {
toast.success(`Successfully signed LLC agreement!`)
},
{
onSuccess() {
// invalidate all except stake connection
queryClient.invalidateQueries({
predicate: (query) => query.queryKey[0] !== StakeConnectionQueryKey,
})
},

onError(error: Error) {
toast.error(error.message)
},
Expand Down
2 changes: 1 addition & 1 deletion staking/app/StakeConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ export class StakeConnection {
}

/**
* Join the DAO LLC for the give stake account.
* Join the DAO LLC for the given stake account.
*/
public async joinDaoLlc(stakeAccount: StakeAccount) {
const transaction: Transaction = new Transaction();
Expand Down

0 comments on commit ff8e6be

Please sign in to comment.