ghost-portal/packages/page-council/src/useModuleElections.ts
Jaco 42cb6b84d3
Rework collective queries (#5732)
* Rework collective queries

* members derive

* All via derive

* Adjust society useMembers

* Adjust optional consts

* Detect council module locations

* Adjust tech comm with module locations

* Rework loading

* Unused type import
2021-07-02 10:42:13 +02:00

23 lines
536 B
TypeScript

// Copyright 2017-2021 @polkadot/app-council authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { useMemo } from 'react';
import { useApi } from '@polkadot/react-hooks';
export function useModuleElections (): string | null {
const { api } = useApi();
return useMemo(
(): string | null =>
api.tx.phragmenElection
? 'phragmenElection'
: api.tx.electionsPhragmen
? 'electionsPhragmen'
: api.tx.elections
? 'elections'
: null,
[api]
);
}