import PropTypes from 'prop-types'; import React from 'react'; class APIKeyForm extends React.Component { constructor(props) { super(props); this.state = { keyLabel: '' }; this.addKey = this.addKey.bind(this); } addKey(event) { // TODO console.log('addKey'); this.props.updateSettings(); event.preventDefault(); return false; } removeKey(k) { // TODO console.log(k); } render() { return (

Key label

{ this.setState({ keyLabel: event.target.value }); }} />
{[{ id: 1, label: 'MyFirstAPI', createdAt: new Date(), lastUsedAt: new Date() }, { id: 2, label: 'MyOtherAPI', createdAt: new Date(), lastUsedAt: new Date() }].map(v => ( ))}
{v.label}
Created on: {v.createdAt.toLocaleDateString()} {v.createdAt.toLocaleTimeString()}
Last used on:
{v.lastUsedAt.toLocaleDateString()} {v.lastUsedAt.toLocaleTimeString()}
); } } APIKeyForm.propTypes = { updateSettings: PropTypes.func.isRequired, }; export default APIKeyForm;