text: import React from "react";
  import {login} from "./UserFunction";
  // reactstrap components
  import {
      Button,
      Card,
      CardHeader,
      CardBody,
      FormGroup,
      Form,
      Input,
      InputGroupAddon,
      InputGroupText,
      InputGroup,
      Row,
      Col
  } from "reactstrap";
  
  class Login extends React.Component {
      constructor() {
          super()
          this.state = {
              email: '',
              password: '',
              errors: {}
          }
  
          this.onChange = this.onChange.bind(this)
          this.onSubmit = this.onSubmit.bind(this)
      }
  
      onChange(e) {
          this.setState({ [e.target.name]: e.target.value })
      }
      onSubmit(e) {
          e.preventDefault();
  
          const user = {
              email: this.state.email,
              password: this.state.password
          }
  
          login(user).then(res => {
              if (res) {
                  this.props.history.push(`/admin/UserProfile`)
              }
          })
      }
  
      render() {
          return (
              <>
                  <Col lg="5" md="7">
                      <Card className="bg-secondary shadow border-0">
  
                          <CardBody className="px-lg-5 py-lg-5">
                              <div className="text-center text-muted mb-4">
                                  <small>sign in with credentials</small>
                              </div>
                              <Form   role="form" onSubmit={this.onSubmit}>
                                  <FormGroup className="mb-3">
                                      <InputGroup className="input-group-alternative">
                                          <InputGroupAddon addonType="prepend">
                                              <InputGroupText>
                                                  <i className="ni ni-email-83" />
                                              </InputGroupText>
                                          </InputGroupAddon>
                                          <Input placeholder="Email" type="email" name="email" value={this.state.email} onChange={this.onChange} />
                                      </InputGroup>
                                  </FormGroup>
                                  <FormGroup>
                                      <InputGroup className="input-group-alternative">
                                          <InputGroupAddon addonType="prepend">
                                              <InputGroupText>
                                                  <i className="ni ni-lock-circle-open" />
                                              </InputGroupText>
                                          </InputGroupAddon>
                                          <Input placeholder="Password" type="password" name="password" value={this.state.password} onChange={this.onChange} />
                                      </InputGroup>
                                  </FormGroup>
  
                                  <div className="text-center">
                                      <Button className="my-4" color="primary" type="submit">
                                          Sign in
                                      </Button>
                                  </div>
                              </Form>
                          </CardBody>
                      </Card>
                      <Row className="mt-3">
                          <Col xs="6">
  
                          </Col>
  
                      </Row>
                  </Col>
              </>
          );
      }
  }
  
  export default Login;
  