import React, { PropTypes, Component } from 'react';
import { Button, FormControl } from 'react-bootstrap';
import { Accounts } from 'meteor/std:accounts-ui';
import { withApollo } from 'react-apollo';
import { registerComponent } from 'meteor/nova:core';
Accounts.ui.config({
passwordSignupFields: 'USERNAME_AND_EMAIL',
});
const AccountsForm = ({client}) => {
return (
client.resetStore()}
onSignedInHook={() => client.resetStore()}
onSignedOutHook={() => client.resetStore()}
/>
)
}
class AccountsButton extends Accounts.ui.Button {
render () {
const {label, href, type, disabled, className, onClick} = this.props;
if (type === 'link') {
return { label };
}
return ;
}
}
class AccountsField extends Accounts.ui.Field {
render() {
const { id, hint, /* label, */ type = 'text', onChange, className = "field", defaultValue = "", message } = this.props;
const { mount = true } = this.state;
return mount ? (
{ this.input = ref; }} onChange={ onChange } placeholder={ hint } defaultValue={ defaultValue } />
{message && (
{message.message}
)}
) : null;
}
}
Accounts.ui.Button = AccountsButton;
Accounts.ui.Field = AccountsField;
registerComponent('AccountsForm', AccountsForm, withApollo);