From 6dbcb37ea24b4d7d4c0806736fee71c36d4a3032 Mon Sep 17 00:00:00 2001 From: Jayasanka Date: Mon, 22 Apr 2019 22:58:47 +0530 Subject: [PATCH] Send request from login page --- .../react-app/package.json | 1 + .../react-app/src/pages/Login.js | 31 +++++++++++++------ 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/package.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/package.json index 5b15c2b6c92..3aa97aca334 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/package.json +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/package.json @@ -12,6 +12,7 @@ "dependencies": { "acorn": "^6.1.1", "antd": "^3.15.0", + "axios": "^0.18.0", "react": "^16.8.4", "react-dom": "^16.8.4", "react-highlight-words": "^0.16.0", diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/Login.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/Login.js index f4faa2a3489..d6b1b3fa15f 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/Login.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/Login.js @@ -1,6 +1,8 @@ import React from "react"; import {Typography, Row, Col, Form, Icon, Input, Button, Checkbox,} from 'antd'; import styles from './Login.less'; +import axios from 'axios'; + const {Title} = Typography; class Login extends React.Component { @@ -38,26 +40,36 @@ class NormalLoginForm extends React.Component { this.props.form.validateFields((err, values) => { if (!err) { 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() { - const { getFieldDecorator } = this.props.form; + const {getFieldDecorator} = this.props.form; return (
- {getFieldDecorator('userName', { - rules: [{ required: true, message: 'Please input your username!' }], + {getFieldDecorator('username', { + rules: [{required: true, message: 'Please input your username!'}], })( - } placeholder="Username" /> + } + placeholder="Username"/> )} {getFieldDecorator('password', { - rules: [{ required: true, message: 'Please input your Password!' }], + rules: [{required: true, message: 'Please input your Password!'}], })( - } type="password" placeholder="Password" /> + } type="password" + placeholder="Password"/> )} @@ -65,19 +77,18 @@ class NormalLoginForm extends React.Component { valuePropName: 'checked', initialValue: true, })( - Remember me + Remember me.... )} Forgot password - Or register now!
); } } -const WrappedNormalLoginForm = Form.create({ name: 'normal_login' })(NormalLoginForm); +const WrappedNormalLoginForm = Form.create({name: 'normal_login'})(NormalLoginForm); export default Login;