diff --git a/packages/client/src/components/Input.tsx b/packages/client/src/components/Input.tsx index cebf0fa..2413f39 100644 --- a/packages/client/src/components/Input.tsx +++ b/packages/client/src/components/Input.tsx @@ -5,6 +5,7 @@ export interface IInputProps { type: 'text' | 'password' | 'hidden' | 'submit' value?: string onChange?: (name: this['name'], value: string) => void + placeholder?: string readOnly?: boolean } @@ -21,6 +22,7 @@ export class Input extends React.PureComponent { type={this.props.type} value={this.props.value} onChange={this.handleChange} + placeholder={this.props.placeholder} readOnly={!!this.props.readOnly} /> ) diff --git a/packages/client/src/login/LoginForm.tsx b/packages/client/src/login/LoginForm.tsx index c325c8c..724f6ff 100644 --- a/packages/client/src/login/LoginForm.tsx +++ b/packages/client/src/login/LoginForm.tsx @@ -5,7 +5,7 @@ import {ICredentials} from '@rondo/common' export interface ILoginFormProps { error?: string onSubmit: (credentials: ICredentials) => Promise - onSuccess: () => void + onSuccess?: () => void } export interface ILoginFormState extends ICredentials {} @@ -23,8 +23,11 @@ export class LoginForm extends React.PureComponent< } } handleSubmit = async () => { + const {onSuccess} = this.props await this.props.onSubmit(this.state) - this.props.onSuccess() + if (onSuccess) { + onSuccess() + } } handleChange = (name: string, value: string) => { this.setState( @@ -40,12 +43,14 @@ export class LoginForm extends React.PureComponent< type='text' onChange={this.handleChange} value={this.state.username} + placeholder='Username' />