ghost-portal/packages/page-council/src/useModuleElections.ts
Jaco 4929b1c6fd
Update headers for 2023 (#8665)
* Update headers for 2023

* Adjust env-config
2023-01-01 10:32:05 +02:00

24 lines
615 B
TypeScript

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