mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
listed apps
This commit is contained in:
parent
c1cf3faba9
commit
b3d87186eb
@ -0,0 +1,16 @@
|
||||
import axios from "axios";
|
||||
import {GET_APPS} from "../constants/action-types";
|
||||
|
||||
export function getApps() {
|
||||
axios.post('https://localhost:9443/api/application-mgt-handler/v1.0/invoke', request
|
||||
).then(res => {
|
||||
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';
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -1 +1,3 @@
|
||||
export const LOGIN = "LOGIN";
|
||||
export const GET_APPS = "GET_APPS";
|
||||
|
||||
|
||||
@ -1,8 +1,15 @@
|
||||
const initialState = {
|
||||
import {GET_APPS} from "../constants/action-types";
|
||||
|
||||
const initialState = {
|
||||
apps : []
|
||||
};
|
||||
|
||||
function rootReducer(state = initialState, action) {
|
||||
if (action.type === GET_APPS) {
|
||||
return Object.assign({}, state, {
|
||||
apps: state.apps.concat(action.payload)
|
||||
});
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
@ -23,41 +23,9 @@ const routes = [
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
const data = [{
|
||||
key: '1',
|
||||
icon: 'https://gw.alipayobjects.com/zos/rmsportal/zOsKZmFRdUtvpqCImOVY.png',
|
||||
name: 'John Brown',
|
||||
platform: 'android',
|
||||
type: 'Enterprise',
|
||||
status: 'published',
|
||||
version: '13.0.0.1',
|
||||
updated_at: '27-03-2019 08:27'
|
||||
},{
|
||||
key: '2',
|
||||
icon: 'http://aztechbeat.com/wp-content/uploads/2014/04/confide-app-icon.png',
|
||||
name: 'Lorem Ipsum',
|
||||
platform: 'ios',
|
||||
type: 'Enterprise',
|
||||
status: 'published',
|
||||
version: '2.3.1.2',
|
||||
updated_at: '27-03-2019 09:45'
|
||||
},{
|
||||
key: '3',
|
||||
icon: 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRx2Xx1-hnH16EGZHUlT06nOcfGODPoboA2TXKaBVtODto4lJtK',
|
||||
name: 'Lorem Ipsum',
|
||||
platform: 'ios',
|
||||
type: 'Enterprise',
|
||||
status: 'removed',
|
||||
version: '4.1.1.0',
|
||||
updated_at: '27-03-2019 09:46'
|
||||
}];
|
||||
|
||||
class Apps extends React.Component {
|
||||
routes;
|
||||
|
||||
|
||||
state = {
|
||||
searchText: '',
|
||||
};
|
||||
@ -79,14 +47,27 @@ class Apps extends React.Component {
|
||||
axios.post('https://localhost:9443/api/application-mgt-handler/v1.0/invoke', request
|
||||
).then(res => {
|
||||
if(res.status === 200){
|
||||
console.log(res.status);
|
||||
let apps = [];
|
||||
res.data['data']['applications'].forEach(function (app) {
|
||||
apps.push({
|
||||
key: app.id,
|
||||
icon: app["applicationReleases"][0]["iconPath"],
|
||||
name: app.name,
|
||||
platform: 'undefined',
|
||||
type: app.type,
|
||||
status: 'undefined',
|
||||
version: 'undefined',
|
||||
updated_at: 'undefined'
|
||||
});
|
||||
});
|
||||
thisComponent.setState({
|
||||
data : []
|
||||
data : apps
|
||||
})
|
||||
}
|
||||
|
||||
}).catch(function (error) {
|
||||
if(error.response.status === 401){
|
||||
console.log("bis");
|
||||
window.location.href = 'https://localhost:9443/publisher/login';
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user