Send request from login page

feature/appm-store/pbac
Jayasanka 6 years ago
parent eeb4d961d0
commit 6dbcb37ea2

@ -12,6 +12,7 @@
"dependencies": { "dependencies": {
"acorn": "^6.1.1", "acorn": "^6.1.1",
"antd": "^3.15.0", "antd": "^3.15.0",
"axios": "^0.18.0",
"react": "^16.8.4", "react": "^16.8.4",
"react-dom": "^16.8.4", "react-dom": "^16.8.4",
"react-highlight-words": "^0.16.0", "react-highlight-words": "^0.16.0",

@ -1,6 +1,8 @@
import React from "react"; import React from "react";
import {Typography, Row, Col, Form, Icon, Input, Button, Checkbox,} from 'antd'; import {Typography, Row, Col, Form, Icon, Input, Button, Checkbox,} from 'antd';
import styles from './Login.less'; import styles from './Login.less';
import axios from 'axios';
const {Title} = Typography; const {Title} = Typography;
class Login extends React.Component { class Login extends React.Component {
@ -38,26 +40,36 @@ class NormalLoginForm extends React.Component {
this.props.form.validateFields((err, values) => { this.props.form.validateFields((err, values) => {
if (!err) { if (!err) {
console.log('Received values of form: ', values); console.log('Received values of form: ', values);
let data = "username="+values.username+"&password="+values.password+"&platform=publisher";
axios.post('https://localhost:9443/api/application-mgt-handler/v1.0/login', data
).then(res => {
console.log(res);
console.log(res.data);
})
} }
}); });
} };
render() { render() {
const {getFieldDecorator} = this.props.form; const {getFieldDecorator} = this.props.form;
return ( return (
<Form onSubmit={this.handleSubmit} className="login-form"> <Form onSubmit={this.handleSubmit} className="login-form">
<Form.Item> <Form.Item>
{getFieldDecorator('userName', { {getFieldDecorator('username', {
rules: [{required: true, message: 'Please input your username!'}], rules: [{required: true, message: 'Please input your username!'}],
})( })(
<Input style={{height: 32}} prefix={<Icon type="user" style={{ color: 'rgba(0,0,0,.25)' }} />} placeholder="Username" /> <Input style={{height: 32}} prefix={<Icon type="user" style={{color: 'rgba(0,0,0,.25)'}}/>}
placeholder="Username"/>
)} )}
</Form.Item> </Form.Item>
<Form.Item> <Form.Item>
{getFieldDecorator('password', { {getFieldDecorator('password', {
rules: [{required: true, message: 'Please input your Password!'}], rules: [{required: true, message: 'Please input your Password!'}],
})( })(
<Input style={{height: 32}} className={styles.input} prefix={<Icon type="lock" style={{ color: 'rgba(0,0,0,.25)' }} />} type="password" placeholder="Password" /> <Input style={{height: 32}} className={styles.input}
prefix={<Icon type="lock" style={{color: 'rgba(0,0,0,.25)'}}/>} type="password"
placeholder="Password"/>
)} )}
</Form.Item> </Form.Item>
<Form.Item> <Form.Item>
@ -65,13 +77,12 @@ class NormalLoginForm extends React.Component {
valuePropName: 'checked', valuePropName: 'checked',
initialValue: true, initialValue: true,
})( })(
<Checkbox>Remember me</Checkbox> <Checkbox>Remember me....</Checkbox>
)} )}
<a className="login-form-forgot" href="">Forgot password</a> <a className="login-form-forgot" href="">Forgot password</a>
<Button block type="primary" htmlType="submit" className="login-form-button"> <Button block type="primary" htmlType="submit" className="login-form-button">
Log in Log in
</Button> </Button>
Or <a href="">register now!</a>
</Form.Item> </Form.Item>
</Form> </Form>
); );

Loading…
Cancel
Save