Просмотр исходного кода

Rename to withOnlyAccounts for consitency

Leszek Wiesner 4 лет назад
Родитель
Сommit
ba5cc9ecab

+ 2 - 2
packages/app-staking/src/Actions/Accounts.tsx

@@ -8,7 +8,7 @@ import { I18nProps } from '@polkadot/react-components/types';
 import { SubjectInfo } from '@polkadot/ui-keyring/observable/types';
 import { KeyringSectionOption } from '@polkadot/ui-keyring/options/types';
 import { withCalls, withMulti } from '@polkadot/react-api/with';
-import { withAccountRequired } from '@polkadot/joy-utils/MyAccount';
+import { withOnlyAccounts } from '@polkadot/joy-utils/MyAccount';
 
 import React, { useState } from 'react';
 import styled from 'styled-components';
@@ -83,7 +83,7 @@ function Accounts({
 }
 
 export default withMulti(
-  withAccountRequired(
+  withOnlyAccounts(
     styled(Accounts)`
       .ui--CardGrid-buttons {
         text-align: right;

+ 3 - 2
packages/joy-utils/src/MyAccount.tsx

@@ -320,8 +320,9 @@ export function AccountRequired<P extends {}>(Component: React.ComponentType<P>)
   };
 }
 
-// TODO: Remove "withMyAccount" after making sure it doesn't break anything (or change the name to "withOnlyAccount" for consistency)
-export const withAccountRequired = <P extends MyAccountProps>(Component: React.ComponentType<P>): React.ComponentType<P> =>
+// TODO: We could probably use withAccountRequired, which wouldn't pass any addiotional props, just like withMembershipRequired.
+// Just need to make sure those passed props are not used in the extended components (they probably aren't).
+export const withOnlyAccounts = <P extends MyAccountProps>(Component: React.ComponentType<P>): React.ComponentType<P> =>
   withMulti(Component, withMyAccount, AccountRequired);
 
 export const withMembershipRequired = <P extends {}> (Component: React.ComponentType<P>): React.ComponentType<P> =>