From f7c61f46984928491f074851d01cd88ef969ac33 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Thu, 7 May 2020 19:53:13 +0200 Subject: [PATCH] Pull members from collective itself (isMember checks) (#2704) * Pull members from collective itself (isMember checks) * trigger stuck CI (hopefully) --- .123trigger | 2 +- packages/react-hooks/src/useMembers.ts | 17 +++-------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/.123trigger b/.123trigger index 7f8f011eb7..45a4fb75db 100644 --- a/.123trigger +++ b/.123trigger @@ -1 +1 @@ -7 +8 diff --git a/packages/react-hooks/src/useMembers.ts b/packages/react-hooks/src/useMembers.ts index 86eb5fd3f7..19ca6e72e2 100644 --- a/packages/react-hooks/src/useMembers.ts +++ b/packages/react-hooks/src/useMembers.ts @@ -2,7 +2,6 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DeriveElectionsInfo } from '@polkadot/api-derive/types'; import { AccountId } from '@polkadot/types/interfaces'; import { useEffect, useState } from 'react'; @@ -17,19 +16,9 @@ export default function useMembers (collective: 'council' | 'technicalCommittee' const { api } = useApi(); const { allAccounts, hasAccounts } = useAccounts(); const [state, setState] = useState({ isMember: false, members: [] }); - const retrieved = ( - collective === 'council' - // eslint-disable-next-line react-hooks/rules-of-hooks - ? useCall(hasAccounts && api.derive.elections.info, [], { - transform: ({ members }: DeriveElectionsInfo): string[] => - members.map(([accountId]) => accountId.toString()) - }) - // eslint-disable-next-line react-hooks/rules-of-hooks - : useCall(hasAccounts && api.query.technicalCommittee?.members, [], { - transform: (accounts: AccountId[]): string[] => - accounts.map((accountId) => accountId.toString()) - }) - ); + const retrieved = useCall(hasAccounts && api.query[collective]?.members, [], { + transform: (accounts: AccountId[]) => accounts.map((accountId) => accountId.toString()) + }); useEffect((): void => { retrieved && setState({