mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge branch 'application-mgt-new' of https://gitlab.com/entgra/carbon-device-mgt into application-mgt-new
This commit is contained in:
commit
705f6fbbe4
@ -463,68 +463,94 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
|
||||
throws ApplicationManagementException {
|
||||
try {
|
||||
//todo rethink and modify the {@link App} usage
|
||||
App app = new App();
|
||||
MobileAppTypes mobileAppType = MobileAppTypes.valueOf(application.getType());
|
||||
if (DeviceTypes.ANDROID.toString().equalsIgnoreCase(deviceType)) {
|
||||
if (ApplicationType.CUSTOM.toString().equalsIgnoreCase(application.getType())) {
|
||||
ProfileOperation operation = new ProfileOperation();
|
||||
if (SubAction.INSTALL.toString().equalsIgnoreCase(action)) {
|
||||
app.setType(mobileAppType);
|
||||
app.setLocation(application.getApplicationReleases().get(0).getInstallerPath());
|
||||
return MDMAndroidOperationUtil.createInstallAppOperation(app);
|
||||
operation.setCode(MDMAppConstants.AndroidConstants.OPCODE_INSTALL_APPLICATION);
|
||||
operation.setType(Operation.Type.PROFILE);
|
||||
CustomApplication customApplication = new CustomApplication();
|
||||
customApplication.setType(application.getType());
|
||||
customApplication.setUrl(application.getApplicationReleases().get(0).getInstallerPath());
|
||||
operation.setPayLoad(customApplication.toJSON());
|
||||
return operation;
|
||||
} else if (SubAction.UNINSTALL.toString().equalsIgnoreCase(action)) {
|
||||
return MDMAndroidOperationUtil.createAppUninstallOperation(app);
|
||||
} else {
|
||||
String msg = "Invalid Action is found. Action: " + action;
|
||||
log.error(msg);
|
||||
throw new ApplicationManagementException(msg);
|
||||
}
|
||||
} else if (DeviceTypes.IOS.toString().equalsIgnoreCase(deviceType)) {
|
||||
if (SubAction.INSTALL.toString().equalsIgnoreCase(action)) {
|
||||
String plistDownloadEndpoint = APIUtil.getArtifactDownloadBaseURL()
|
||||
+ MDMAppConstants.IOSConstants.PLIST + Constants.FORWARD_SLASH
|
||||
+ application.getApplicationReleases().get(0).getUuid();
|
||||
app.setType(mobileAppType);
|
||||
app.setLocation(plistDownloadEndpoint);
|
||||
Properties properties = new Properties();
|
||||
properties.put(MDMAppConstants.IOSConstants.IS_PREVENT_BACKUP, true);
|
||||
properties.put(MDMAppConstants.IOSConstants.IS_REMOVE_APP, true);
|
||||
app.setProperties(properties);
|
||||
return MDMIOSOperationUtil.createInstallAppOperation(app);
|
||||
} else if (SubAction.UNINSTALL.toString().equalsIgnoreCase(action)) {
|
||||
return MDMIOSOperationUtil.createAppUninstallOperation(app);
|
||||
operation.setCode(MDMAppConstants.AndroidConstants.OPCODE_UNINSTALL_APPLICATION);
|
||||
operation.setType(Operation.Type.PROFILE);
|
||||
CustomApplication customApplication = new CustomApplication();
|
||||
customApplication.setType(application.getType());
|
||||
//todo get application package name and set
|
||||
operation.setPayLoad(customApplication.toJSON());
|
||||
return operation;
|
||||
} else {
|
||||
String msg = "Invalid Action is found. Action: " + action;
|
||||
log.error(msg);
|
||||
throw new ApplicationManagementException(msg);
|
||||
}
|
||||
} else {
|
||||
if (ApplicationType.CUSTOM.toString().equalsIgnoreCase(application.getType())) {
|
||||
App app = new App();
|
||||
MobileAppTypes mobileAppType = MobileAppTypes.valueOf(application.getType());
|
||||
if (DeviceTypes.ANDROID.toString().equalsIgnoreCase(deviceType)) {
|
||||
if (SubAction.INSTALL.toString().equalsIgnoreCase(action)) {
|
||||
ProfileOperation operation = new ProfileOperation();
|
||||
operation.setCode(MDMAppConstants.AndroidConstants.OPCODE_INSTALL_APPLICATION);
|
||||
operation.setType(Operation.Type.PROFILE);
|
||||
CustomApplication customApplication = new CustomApplication();
|
||||
customApplication.setType(application.getType());
|
||||
customApplication.setUrl(application.getApplicationReleases().get(0).getInstallerPath());
|
||||
operation.setPayLoad(customApplication.toJSON());
|
||||
return operation;
|
||||
app.setType(mobileAppType);
|
||||
app.setLocation(application.getApplicationReleases().get(0).getInstallerPath());
|
||||
return MDMAndroidOperationUtil.createInstallAppOperation(app);
|
||||
} else if (SubAction.UNINSTALL.toString().equalsIgnoreCase(action)) {
|
||||
ProfileOperation operation = new ProfileOperation();
|
||||
operation.setCode(MDMAppConstants.AndroidConstants.OPCODE_UNINSTALL_APPLICATION);
|
||||
operation.setType(Operation.Type.PROFILE);
|
||||
CustomApplication customApplication = new CustomApplication();
|
||||
customApplication.setType(application.getType());
|
||||
//todo get application package name and set
|
||||
operation.setPayLoad(customApplication.toJSON());
|
||||
return MDMAndroidOperationUtil.createAppUninstallOperation(app);
|
||||
} else {
|
||||
String msg = "Invalid Action is found. Action: " + action;
|
||||
log.error(msg);
|
||||
throw new ApplicationManagementException(msg);
|
||||
}
|
||||
} else if (DeviceTypes.IOS.toString().equalsIgnoreCase(deviceType)) {
|
||||
if (SubAction.INSTALL.toString().equalsIgnoreCase(action)) {
|
||||
String plistDownloadEndpoint =
|
||||
APIUtil.getArtifactDownloadBaseURL() + MDMAppConstants.IOSConstants.PLIST
|
||||
+ Constants.FORWARD_SLASH + application.getApplicationReleases().get(0)
|
||||
.getUuid();
|
||||
app.setType(mobileAppType);
|
||||
app.setLocation(plistDownloadEndpoint);
|
||||
Properties properties = new Properties();
|
||||
properties.put(MDMAppConstants.IOSConstants.IS_PREVENT_BACKUP, true);
|
||||
properties.put(MDMAppConstants.IOSConstants.IS_REMOVE_APP, true);
|
||||
app.setProperties(properties);
|
||||
return MDMIOSOperationUtil.createInstallAppOperation(app);
|
||||
} else if (SubAction.UNINSTALL.toString().equalsIgnoreCase(action)) {
|
||||
return MDMIOSOperationUtil.createAppUninstallOperation(app);
|
||||
} else {
|
||||
String msg = "Invalid Action is found. Action: " + action;
|
||||
log.error(msg);
|
||||
throw new ApplicationManagementException(msg);
|
||||
}
|
||||
} else {
|
||||
String msg = "Invalid device type is found. Device Type: " + deviceType;
|
||||
log.error(msg);
|
||||
throw new ApplicationManagementException(msg);
|
||||
if (ApplicationType.CUSTOM.toString().equalsIgnoreCase(application.getType())) {
|
||||
if (SubAction.INSTALL.toString().equalsIgnoreCase(action)) {
|
||||
ProfileOperation operation = new ProfileOperation();
|
||||
operation.setCode(MDMAppConstants.AndroidConstants.OPCODE_INSTALL_APPLICATION);
|
||||
operation.setType(Operation.Type.PROFILE);
|
||||
CustomApplication customApplication = new CustomApplication();
|
||||
customApplication.setType(application.getType());
|
||||
customApplication.setUrl(application.getApplicationReleases().get(0).getInstallerPath());
|
||||
operation.setPayLoad(customApplication.toJSON());
|
||||
return operation;
|
||||
} else if (SubAction.UNINSTALL.toString().equalsIgnoreCase(action)) {
|
||||
ProfileOperation operation = new ProfileOperation();
|
||||
operation.setCode(MDMAppConstants.AndroidConstants.OPCODE_UNINSTALL_APPLICATION);
|
||||
operation.setType(Operation.Type.PROFILE);
|
||||
CustomApplication customApplication = new CustomApplication();
|
||||
customApplication.setType(application.getType());
|
||||
//todo get application package name and set
|
||||
operation.setPayLoad(customApplication.toJSON());
|
||||
return MDMAndroidOperationUtil.createAppUninstallOperation(app);
|
||||
} else {
|
||||
String msg = "Invalid Action is found. Action: " + action;
|
||||
log.error(msg);
|
||||
throw new ApplicationManagementException(msg);
|
||||
}
|
||||
} else {
|
||||
String msg = "Invalid device type is found. Device Type: " + deviceType;
|
||||
log.error(msg);
|
||||
throw new ApplicationManagementException(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (UnknownApplicationTypeException e) {
|
||||
|
||||
@ -21,6 +21,7 @@ import AppCard from "./AppCard";
|
||||
import {Col, message, notification, Row, Result, Skeleton} from "antd";
|
||||
import axios from "axios";
|
||||
import {withConfigContext} from "../../context/ConfigContext";
|
||||
import {handleApiError} from "../../js/Utils";
|
||||
|
||||
class AppList extends React.Component {
|
||||
constructor(props) {
|
||||
@ -72,20 +73,7 @@ class AppList extends React.Component {
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
console.log(error.response);
|
||||
if (error.hasOwnProperty("response") && error.response.status === 401) {
|
||||
//todo display a popup with error
|
||||
message.error('You are not logged in');
|
||||
window.location.href = window.location.origin+ '/store/login';
|
||||
} else {
|
||||
notification["error"]({
|
||||
message: "There was a problem",
|
||||
duration: 0,
|
||||
description:
|
||||
"Error occurred while trying to load apps.",
|
||||
});
|
||||
}
|
||||
|
||||
handleApiError(error,"Error occurred while trying to load apps.");
|
||||
this.setState({loading: false});
|
||||
});
|
||||
};
|
||||
|
||||
@ -17,11 +17,12 @@
|
||||
*/
|
||||
|
||||
import React from "react";
|
||||
import {Row, Typography, Icon} from "antd";
|
||||
import {Row, Typography, Icon, notification} from "antd";
|
||||
import StarRatings from "react-star-ratings";
|
||||
import "./DetailedRating.css";
|
||||
import axios from "axios";
|
||||
import {withConfigContext} from "../../../context/ConfigContext";
|
||||
import {handleApiError} from "../../../js/Utils";
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
@ -62,9 +63,7 @@ class DetailedRating extends React.Component{
|
||||
}
|
||||
|
||||
}).catch(function (error) {
|
||||
if (error.response.status === 401) {
|
||||
window.location.href = window.location.origin+'/store/login';
|
||||
}
|
||||
handleApiError(error,"Error occurred while trying to load ratings.");
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@ -27,6 +27,7 @@ import axios from "axios";
|
||||
import AppInstallModal from "./install/AppInstallModal";
|
||||
import CurrentUsersReview from "./review/CurrentUsersReview";
|
||||
import {withConfigContext} from "../../../context/ConfigContext";
|
||||
import {handleApiError} from "../../../js/Utils";
|
||||
|
||||
const {Title, Text, Paragraph} = Typography;
|
||||
|
||||
@ -78,20 +79,7 @@ class ReleaseView extends React.Component {
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
if (error.response.status === 401) {
|
||||
window.location.href = window.location.origin+ '/store/login';
|
||||
} else {
|
||||
this.setState({
|
||||
loading: false,
|
||||
visible: false
|
||||
});
|
||||
notification["error"]({
|
||||
message: "There was a problem",
|
||||
duration: 0,
|
||||
description:
|
||||
"Error occurred while installing the app.",
|
||||
});
|
||||
}
|
||||
handleApiError(error,"Error occurred while installing the app.");
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@ -24,6 +24,7 @@ import TimeAgo from 'javascript-time-ago'
|
||||
// Load locale-specific relative date/time formatting rules.
|
||||
import en from 'javascript-time-ago/locale/en'
|
||||
import {withConfigContext} from "../../../../context/ConfigContext";
|
||||
import {handleApiError} from "../../../../js/Utils";
|
||||
|
||||
const {Text} = Typography;
|
||||
const columns = [
|
||||
@ -166,20 +167,7 @@ class DeviceInstall extends React.Component {
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
console.log(error);
|
||||
if (error.hasOwnProperty("status") && error.response.status === 401) {
|
||||
//todo display a popop with error
|
||||
message.error('You are not logged in');
|
||||
window.location.href = window.location.origin + '/store/login';
|
||||
} else {
|
||||
notification["error"]({
|
||||
message: "There was a problem",
|
||||
duration: 0,
|
||||
description:
|
||||
"Error occurred while trying to load devices.",
|
||||
});
|
||||
}
|
||||
|
||||
handleApiError(error,"Error occurred while trying to load devices.");
|
||||
this.setState({loading: false});
|
||||
});
|
||||
};
|
||||
|
||||
@ -21,6 +21,7 @@ import {Typography, Select, Spin, message, notification, Button} from "antd";
|
||||
import debounce from 'lodash.debounce';
|
||||
import axios from "axios";
|
||||
import {withConfigContext} from "../../../../context/ConfigContext";
|
||||
import {handleApiError} from "../../../../js/Utils";
|
||||
|
||||
const {Text} = Typography;
|
||||
const {Option} = Select;
|
||||
@ -64,19 +65,8 @@ class GroupInstall extends React.Component {
|
||||
this.setState({data, fetching: false});
|
||||
}
|
||||
|
||||
}).catch((error) => { console.log(error);
|
||||
if (error.hasOwnProperty("status") && error.response.status === 401) {
|
||||
message.error('You are not logged in');
|
||||
window.location.href = window.location.origin+'/store/login';
|
||||
} else {
|
||||
notification["error"]({
|
||||
message: "There was a problem",
|
||||
duration: 0,
|
||||
description:
|
||||
"Error occurred while trying to load groups.",
|
||||
});
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
handleApiError(error,"Error occurred while trying to load groups.");
|
||||
this.setState({fetching: false});
|
||||
});
|
||||
};
|
||||
|
||||
@ -21,6 +21,7 @@ import {Typography, Select, Spin, message, notification, Button} from "antd";
|
||||
import debounce from 'lodash.debounce';
|
||||
import axios from "axios";
|
||||
import {withConfigContext} from "../../../../context/ConfigContext";
|
||||
import {handleApiError} from "../../../../js/Utils";
|
||||
|
||||
const {Text} = Typography;
|
||||
const {Option} = Select;
|
||||
@ -64,19 +65,8 @@ class RoleInstall extends React.Component {
|
||||
this.setState({data, fetching: false});
|
||||
}
|
||||
|
||||
}).catch((error) => { console.log(error);
|
||||
if (error.hasOwnProperty("status") && error.response.status === 401) {
|
||||
message.error('You are not logged in');
|
||||
window.location.href = window.location.origin+'/store/login';
|
||||
} else {
|
||||
notification["error"]({
|
||||
message: "There was a problem",
|
||||
duration: 0,
|
||||
description:
|
||||
"Error occurred while trying to load roles.",
|
||||
});
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
handleApiError(error,"Error occurred while trying to load roles.");
|
||||
this.setState({fetching: false});
|
||||
});
|
||||
};
|
||||
|
||||
@ -21,6 +21,7 @@ import {Typography, Select, Spin, message, notification, Button} from "antd";
|
||||
import debounce from 'lodash.debounce';
|
||||
import axios from "axios";
|
||||
import {withConfigContext} from "../../../../context/ConfigContext";
|
||||
import {handleApiError} from "../../../../js/Utils";
|
||||
|
||||
const {Text} = Typography;
|
||||
const {Option} = Select;
|
||||
@ -67,18 +68,7 @@ class UserInstall extends React.Component {
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
if (error.response.hasOwnProperty(status) && error.response.status === 401) {
|
||||
message.error('You are not logged in');
|
||||
window.location.href = window.location.origin+ '/store/login';
|
||||
} else {
|
||||
notification["error"]({
|
||||
message: "There was a problem",
|
||||
duration: 0,
|
||||
description:
|
||||
"Error occurred while trying to load users.",
|
||||
});
|
||||
}
|
||||
|
||||
handleApiError(error,"Error occurred while trying to load users.");
|
||||
this.setState({fetching: false});
|
||||
});
|
||||
};
|
||||
|
||||
@ -21,6 +21,7 @@ import {Drawer, Button, Icon, Row, Col, Typography, Divider, Input, Spin, notifi
|
||||
import StarRatings from "react-star-ratings";
|
||||
import axios from "axios";
|
||||
import {withConfigContext} from "../../../../context/ConfigContext";
|
||||
import {handleApiError} from "../../../../js/Utils";
|
||||
|
||||
const {Title} = Typography;
|
||||
const {TextArea} = Input;
|
||||
@ -103,20 +104,11 @@ class AddReview extends React.Component {
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
if (error.response.status === 401) {
|
||||
window.location.href = window.location.origin+ '/store/login';
|
||||
} else {
|
||||
this.setState({
|
||||
loading: false,
|
||||
visible: false
|
||||
});
|
||||
notification["error"]({
|
||||
message: "There was a problem",
|
||||
duration: 0,
|
||||
description:
|
||||
"We are unable to add your review right now.",
|
||||
});
|
||||
}
|
||||
handleApiError(error,"We are unable to add your review right now.");
|
||||
this.setState({
|
||||
loading: false,
|
||||
visible: false
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
@ -22,6 +22,7 @@ import SingleReview from "./singleReview/SingleReview";
|
||||
import axios from "axios";
|
||||
import AddReview from "./AddReview";
|
||||
import {withConfigContext} from "../../../../context/ConfigContext";
|
||||
import {handleApiError} from "../../../../js/Utils";
|
||||
|
||||
const {Text, Paragraph} = Typography;
|
||||
|
||||
@ -52,17 +53,7 @@ class CurrentUsersReview extends React.Component {
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
if (error.response.hasOwnProperty(status) && error.response.status === 401) {
|
||||
message.error('You are not logged in');
|
||||
window.location.href = window.location.origin+ '/store/login';
|
||||
} else {
|
||||
notification["error"]({
|
||||
message: "There was a problem",
|
||||
duration: 0,
|
||||
description:
|
||||
"Error occurred while trying to get your review.",
|
||||
});
|
||||
}
|
||||
handleApiError(error,"Error occurred while trying to get your review.");
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@ -24,6 +24,7 @@ import InfiniteScroll from 'react-infinite-scroller';
|
||||
import SingleReview from "./singleReview/SingleReview";
|
||||
import axios from "axios";
|
||||
import {withConfigContext} from "../../../../context/ConfigContext";
|
||||
import {handleApiError} from "../../../../js/Utils";
|
||||
|
||||
const limit = 5;
|
||||
|
||||
@ -60,16 +61,7 @@ class Reviews extends React.Component {
|
||||
}
|
||||
|
||||
}).catch(function (error) {
|
||||
if (error.response.status === 401) {
|
||||
window.location.href = window.location.origin+ '/store/login';
|
||||
} else {
|
||||
notification["error"]({
|
||||
message: "There was a problem",
|
||||
duration: 0,
|
||||
description:
|
||||
"Error occurred while trying to load reviews.",
|
||||
});
|
||||
}
|
||||
handleApiError(error,"Error occurred while trying to load reviews.");
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@ -25,6 +25,7 @@ import "./SingleReview.css";
|
||||
import EditReview from "./editReview/EditReview";
|
||||
import axios from "axios";
|
||||
import {withConfigContext} from "../../../../../context/ConfigContext";
|
||||
import {handleApiError} from "../../../../../js/Utils";
|
||||
|
||||
const {Text, Paragraph} = Typography;
|
||||
const colorList = ['#f0932b', '#badc58', '#6ab04c', '#eb4d4b', '#0abde3', '#9b59b6', '#3498db', '#22a6b3', '#e84393', '#f9ca24'];
|
||||
@ -78,17 +79,7 @@ class SingleReview extends React.Component {
|
||||
this.props.deleteCallback(id);
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.log(error);
|
||||
if (error.hasOwnProperty("response") && error.response.status === 401) {
|
||||
window.location.href = window.location.origin+ '/store/login';
|
||||
} else {
|
||||
notification["error"]({
|
||||
message: "There was a problem",
|
||||
duration: 0,
|
||||
description:
|
||||
"We were unable to delete the review..",
|
||||
});
|
||||
}
|
||||
handleApiError(error,"We were unable to delete the review..");
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
@ -22,6 +22,7 @@ import StarRatings from "react-star-ratings";
|
||||
import axios from "axios";
|
||||
import "./EditReview.css";
|
||||
import {withConfigContext} from "../../../../../../context/ConfigContext";
|
||||
import {handleApiError} from "../../../../../../js/Utils";
|
||||
|
||||
const {Title} = Typography;
|
||||
const {TextArea} = Input;
|
||||
@ -115,21 +116,11 @@ class EditReview extends React.Component {
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
console.log(error);
|
||||
if (error.hasOwnProperty("response") && error.response.status === 401) {
|
||||
window.location.href = window.location.origin+ '/store/login';
|
||||
} else {
|
||||
this.setState({
|
||||
loading: false,
|
||||
visible: false
|
||||
});
|
||||
notification["error"]({
|
||||
message: "There was a problem",
|
||||
duration: 0,
|
||||
description:
|
||||
"We are unable to add your review right now.",
|
||||
});
|
||||
}
|
||||
handleApiError(error,"We are unable to add your review right now.");
|
||||
this.setState({
|
||||
loading: false,
|
||||
visible: false
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved.
|
||||
*
|
||||
* Entgra (pvt) Ltd. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import {notification} from "antd";
|
||||
|
||||
export const handleApiError = (error, message) => {
|
||||
console.log(error);
|
||||
if (error.hasOwnProperty("response") && error.response.status === 401) {
|
||||
window.location.href = window.location.origin + '/store/login';
|
||||
} else {
|
||||
notification["error"]({
|
||||
message: "There was a problem",
|
||||
duration: 0,
|
||||
description: message,
|
||||
});
|
||||
}
|
||||
};
|
||||
@ -21,6 +21,7 @@ import {Typography, Row, Col, Form, Icon, Input, Button, Checkbox} from 'antd';
|
||||
import './Login.css';
|
||||
import axios from 'axios';
|
||||
import {withConfigContext} from "../context/ConfigContext";
|
||||
import {handleApiError} from "../js/Utils";
|
||||
|
||||
const {Title} = Typography;
|
||||
const {Text} = Typography;
|
||||
@ -104,7 +105,8 @@ class NormalLoginForm extends React.Component {
|
||||
window.location = window.location.origin+ "/store";
|
||||
}
|
||||
}).catch(function (error) {
|
||||
if (error.response.status === 400) {
|
||||
handleApiError(error,"Error occurred while trying to load groups.");
|
||||
if (error.hasOwnProperty("response") && error.response.status === 400) {
|
||||
thisForm.setState({
|
||||
inValid: true,
|
||||
loading: false
|
||||
|
||||
@ -26,6 +26,7 @@ import axios from "axios";
|
||||
import "./Dashboard.css";
|
||||
import {withConfigContext} from "../../context/ConfigContext";
|
||||
import Logout from "./logout/Logout";
|
||||
import {handleApiError} from "../../js/Utils";
|
||||
|
||||
const {SubMenu} = Menu;
|
||||
|
||||
@ -58,16 +59,7 @@ class Dashboard extends React.Component {
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
if (error.hasOwnProperty("response") && error.response.status === 401) {
|
||||
window.location.href = window.location.origin + '/store/login';
|
||||
} else {
|
||||
notification["error"]({
|
||||
message: "There was a problem",
|
||||
duration: 0,
|
||||
description:
|
||||
"Error occurred while trying to load device types.",
|
||||
});
|
||||
}
|
||||
handleApiError(error,"Error occurred while trying to load device types.");
|
||||
this.setState({
|
||||
loading: false
|
||||
});
|
||||
|
||||
@ -23,6 +23,7 @@ import ReleaseView from "../../../../components/apps/release/ReleaseView";
|
||||
import axios from "axios";
|
||||
import {withConfigContext} from "../../../../context/ConfigContext";
|
||||
import {Link} from "react-router-dom";
|
||||
import {handleApiError} from "../../../../js/Utils";
|
||||
|
||||
const {Title} = Typography;
|
||||
|
||||
@ -71,20 +72,7 @@ class Release extends React.Component {
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
console.log(error);
|
||||
if (error.hasOwnProperty("response") && error.response.status === 401) {
|
||||
//todo display a popop with error
|
||||
message.error('You are not logged in');
|
||||
window.location.href = window.location.origin + '/store/login';
|
||||
} else {
|
||||
notification["error"]({
|
||||
message: "There was a problem",
|
||||
duration: 0,
|
||||
description:
|
||||
"Error occurred while trying to load releases.",
|
||||
});
|
||||
}
|
||||
|
||||
handleApiError(error,"Error occurred while trying to load releases.");
|
||||
this.setState({loading: false});
|
||||
});
|
||||
};
|
||||
|
||||
@ -20,6 +20,7 @@ import React from "react";
|
||||
import {notification, Menu, Icon} from 'antd';
|
||||
import axios from 'axios';
|
||||
import {withConfigContext} from "../../../context/ConfigContext";
|
||||
import {handleApiError} from "../../../js/Utils";
|
||||
|
||||
/*
|
||||
This class for call the logout api by sending request
|
||||
@ -52,19 +53,7 @@ class Logout extends React.Component {
|
||||
window.location = window.location.origin + "/store/login";
|
||||
}
|
||||
}).catch(function (error) {
|
||||
|
||||
if (error.hasOwnProperty("response") && error.response.status === 400) {
|
||||
thisForm.setState({
|
||||
inValid: true
|
||||
});
|
||||
} else {
|
||||
notification["error"]({
|
||||
message: "There was a problem",
|
||||
duration: 0,
|
||||
description:
|
||||
"Error occurred while trying to logout.",
|
||||
});
|
||||
}
|
||||
handleApiError(error,"Error occurred while trying to get your review.");
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user