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 7a7e27ed674..ba015d08d14 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
@@ -16,10 +16,11 @@
"react": "^16.8.4",
"react-dom": "^16.8.4",
"react-highlight-words": "^0.16.0",
+ "react-router": "latest",
"react-router-config": "^5.0.0",
"react-router-dom": "latest",
"react-scripts": "2.1.8",
- "react-router": "latest"
+ "redux-thunk": "^2.3.0"
},
"devDependencies": {
"@babel/core": "^7.0.0",
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/AppCard.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/AppCard.js
index 1a03260c71c..7ae50e0c90d 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/AppCard.js
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/AppCard.js
@@ -32,7 +32,7 @@ class AppCard extends React.Component {
, , ]}>
}
- title={this.props.title}
+ title={this.props.name}
description={description}
/>
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/AppList.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/AppList.js
index 728fff03825..20d874e0996 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/AppList.js
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/AppList.js
@@ -2,6 +2,7 @@ import React from "react";
import AppCard from "./AppCard";
import {Col, Row} from "antd";
import {connect} from "react-redux";
+import {getApps} from "../js/actions";
// connecting state.articles with the component
const mapStateToProps= state => {
@@ -13,13 +14,17 @@ class ConnectedAppList extends React.Component {
constructor(props) {
super(props);
}
+ componentDidMount() {
+ this.props.getApps();
+ }
render() {
return (
{this.props.apps.map(app => (
- {
- if(res.status === 200){
- return {type: GET_APPS, payload : res.data}
- }
-
- }).catch(function (error) {
- if(error.response.status === 401){
- window.location.href = 'https://localhost:9443/publisher/login';
- }
- });
+
+ return (dispatch) => {
+ const request = "method=post&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/applications";
+
+ return axios.post('https://localhost:9443/api/application-mgt-handler/v1.0/invoke', request
+ ).then(res => {
+ if (res.status === 200) {
+ let apps = [];
+
+ if(res.data.data.hasOwnProperty("applications")){
+ apps = res.data.data.applications;
+ }
+ console.log(res.data);
+ dispatch({type: GET_APPS, payload: apps});
+ }
+
+ }).catch(function (error) {
+ if (error.response.status === 401) {
+ window.location.href = 'https://localhost:9443/publisher/login';
+ }
+ });
+
+ };
+
+
}
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/reducers/index.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/reducers/index.js
index 79a4fd1f905..30934026425 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/reducers/index.js
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/reducers/index.js
@@ -1,28 +1,14 @@
import {GET_APPS} from "../constants/action-types";
const initialState = {
- apps: [{
- id: 1,
- title: 'Hi',
- platform: 'android',
- description: 'lorem',
- subType: 'FREE',
- type: 'ENTERPRISE'
- },
- {
- id: 2,
- title: 'Hi',
- platform: 'android',
- description: 'lorem',
- subType: 'FREE',
- type: 'ENTERPRISE'
- }]
+ apps: []
};
function rootReducer(state = initialState, action) {
if (action.type === GET_APPS) {
+ console.log(11);
return Object.assign({}, state, {
- apps: state.apps.concat(action.payload)
+ apps: action.payload
});
}
return state;
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/store/index.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/store/index.js
index 7209a4b021e..04957eb39a8 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/store/index.js
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/store/index.js
@@ -1,4 +1,5 @@
-import { createStore } from "redux";
+import { createStore, applyMiddleware } from "redux";
import rootReducer from "../reducers/index";
-const store = createStore(rootReducer);
+import thunk from "redux-thunk";
+const store = createStore(rootReducer, applyMiddleware(thunk));
export default store;
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps.js
index 16fc0687f51..92d366a3ae6 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps.js
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps.js
@@ -1,8 +1,6 @@
import React from "react";
import "antd/dist/antd.css";
import {PageHeader, Typography,Input, Button, Row, Col} from "antd";
-
-import AppCard from "../../../components/AppCard";
import AppList from "../../../components/AppList";
const Search = Input.Search;