ghost-keychain/packages/extension-ui/src/Popup/Forget.tsx
Jaco Greeff c70d9a0e63
Swap to eslint (#72)
* 626 problems (430 errors, 196 warnings)

* A start.

* < 200

* 80

* 0
2019-07-12 20:09:44 +02:00

41 lines
1.3 KiB
TypeScript

// Copyright 2019 @polkadot/extension-ui authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { OnActionFromCtx } from '../components/types';
import React from 'react';
import { RouteComponentProps, withRouter } from 'react-router';
import { Address, Button, Header, Tip, withOnAction } from '../components';
import { forgetAccount } from '../messaging';
import { Back } from '../partials';
interface Props extends RouteComponentProps<{ address: string }> {
onAction: OnActionFromCtx;
}
function Forget ({ match: { params: { address } }, onAction }: Props): React.ReactElement<Props> {
const onClick = (): Promise<void> =>
forgetAccount(address)
.then((): void => onAction('/'))
.catch(console.error);
return (
<div>
<Header label='forget account' />
<Back />
<Address address={address}>
<Tip header='danger' type='error'>You are about to remove the account. This means that you will not be able to access it via this extension anymore. If you wish to recover it, you would need to use the seed.</Tip>
<Button
isDanger
label='I want to forget this account'
onClick={onClick}
/>
</Address>
</div>
);
}
export default withOnAction(withRouter(Forget));