- import React, { Component } from 'react';
- import { Button, Card, CardBody, CardGroup, Col, Container, Form, Input, InputGroup, InputGroupAddon, InputGroupText, Row } from 'reactstrap';
- class ApiLogin extends Component {
- constructor() {
- super();
- this.state = {
- username: '',
- Password: ''
- }
- this.Password = this.Password.bind(this);
- this.username = this.username.bind(this);
- this.login = this.login.bind(this);
- }
- username(event) {
- this.setState({ username: event.target.value })
- }
- Password(event) {
- this.setState({ Password: event.target.value })
- }
- login(event) {
- window.fetch('http://*******', {
- method: 'post',
- mode:'no-cors',
- headers: {
- 'Access-Control-Allow-Origin':'http:******'
- },
- body: JSON.stringify({
- username: this.state.username,
- Password: this.state.Password
- })
- }).then((Response) => Response.json())
- .then((result) => {
- console.log(result);
- if (result.Status == 'Invalid')
- alert('Invalid User');
- else
- this.props.history.push("/Dashboard");
- })
- }
- render() {
- return (
- "app flex-row align-items-center">
"justify-content-center"
>"" lg="" xl=""> "p-" >"mb- pageheading">"col-sm- btn btn-primary">- Login
"mb-" >- "text" onChange={this.username} placeholder="Enter username" />
"mb-" >- "password" onChange={this.Password} placeholder="Enter Password" />
- .login} color="success" block>Login
- );
- }
- }
- export default ApiLogin;
Unhandled Rejection (SyntaxError): Unexpected end of input

Salman BegPosted May 30, 2021, 2:35 AM