Skip to content

Commit

Permalink
feat(connect-kt): refresh character-operators after add/remove oper…
Browse files Browse the repository at this point in the history
…ator
  • Loading branch information
runjuu committed Mar 10, 2023
1 parent b44e25d commit 76f0585
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import { CharacterPermissionKey } from "crossbell.js";
import { asyncRetry } from "../../utils";
import { useAccountState } from "../account-state";
import { createAccountTypeBasedMutationHooks } from "../account-type-based-hooks";
import { SCOPE_KEY_CHARACTER_OPERATOR } from "./const";
import {
GET_CHARACTER_OPERATORS_SCOPE_KEY,
SCOPE_KEY_CHARACTER_OPERATOR,
} from "./const";
import { haveSamePermissions } from "./utils";

export const useAddCharacterOperator = createAccountTypeBasedMutationHooks<
Expand Down Expand Up @@ -32,6 +35,9 @@ export const useAddCharacterOperator = createAccountTypeBasedMutationHooks<
return Promise.all([
useAccountState.getState().refresh(),
queryClient.invalidateQueries(SCOPE_KEY_CHARACTER_OPERATOR(variables)),
queryClient.invalidateQueries(
GET_CHARACTER_OPERATORS_SCOPE_KEY(variables)
),
]);
},
}));
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import { indexer } from "@crossbell/indexer";
import { asyncRetry } from "../../utils";
import { useAccountState } from "../account-state";
import { createAccountTypeBasedMutationHooks } from "../account-type-based-hooks";
import { SCOPE_KEY_CHARACTER_OPERATOR } from "./const";
import {
GET_CHARACTER_OPERATORS_SCOPE_KEY,
SCOPE_KEY_CHARACTER_OPERATOR,
} from "./const";

export const useRemoveCharacterOperator = createAccountTypeBasedMutationHooks<
void,
Expand All @@ -26,6 +29,9 @@ export const useRemoveCharacterOperator = createAccountTypeBasedMutationHooks<
return Promise.all([
useAccountState.getState().refresh(),
queryClient.invalidateQueries(SCOPE_KEY_CHARACTER_OPERATOR(variables)),
queryClient.invalidateQueries(
GET_CHARACTER_OPERATORS_SCOPE_KEY(variables)
),
]);
},
}));

0 comments on commit 76f0585

Please sign in to comment.