This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
outline/app/scenes/Settings/components/ApiToken.js

44 lines
833 B
JavaScript

// @flow
import * as React from 'react';
import { observable } from 'mobx';
import { observer } from 'mobx-react';
import Button from 'components/Button';
type Props = {
id: string,
name: ?string,
secret: string,
onDelete: (id: string) => *,
};
@observer
class ApiToken extends React.Component<Props> {
@observable disabled: boolean;
onClick = () => {
this.props.onDelete(this.props.id);
this.disabled = true;
};
render() {
const { name, secret } = this.props;
const { disabled } = this;
return (
<tr>
<td>{name}</td>
<td>
<code>{secret}</code>
</td>
<td align="right">
<Button onClick={this.onClick} disabled={disabled} neutral>
Revoke
</Button>
</td>
</tr>
);
}
}
export default ApiToken;