mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 05:10:19 +08:00
feat: refactor code to use responseOK everywhere (#2111)
* refactor: use responseOK return frontend format json data * revert handle error * revert handle error
This commit is contained in:
@ -68,7 +68,7 @@ class AdapterEditPage extends React.Component {
|
||||
OrganizationBackend.getOrganizations("admin")
|
||||
.then((res) => {
|
||||
this.setState({
|
||||
organizations: (res.msg === undefined) ? res : [],
|
||||
organizations: res.data || [],
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -80,8 +80,9 @@ class AdapterEditPage extends React.Component {
|
||||
Setting.showMessage("error", res.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
models: res,
|
||||
models: res.data,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ class ApplicationEditPage extends React.Component {
|
||||
getApplication() {
|
||||
ApplicationBackend.getApplication("admin", this.state.applicationName)
|
||||
.then((res) => {
|
||||
if (res === null) {
|
||||
if (res.data === null) {
|
||||
this.props.history.push("/404");
|
||||
return;
|
||||
}
|
||||
@ -138,7 +138,7 @@ class ApplicationEditPage extends React.Component {
|
||||
}
|
||||
|
||||
this.setState({
|
||||
application: res,
|
||||
application: res.data,
|
||||
});
|
||||
|
||||
this.getCerts(res.organization);
|
||||
@ -184,9 +184,9 @@ class ApplicationEditPage extends React.Component {
|
||||
|
||||
getSamlMetadata() {
|
||||
ApplicationBackend.getSamlMetadata("admin", this.state.applicationName)
|
||||
.then((res) => {
|
||||
.then((data) => {
|
||||
this.setState({
|
||||
samlMetadata: res,
|
||||
samlMetadata: data,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ class CertEditPage extends React.Component {
|
||||
getCert() {
|
||||
CertBackend.getCert(this.state.owner, this.state.certName)
|
||||
.then((res) => {
|
||||
if (res === null) {
|
||||
if (res.data === null) {
|
||||
this.props.history.push("/404");
|
||||
return;
|
||||
}
|
||||
@ -56,7 +56,7 @@ class CertEditPage extends React.Component {
|
||||
}
|
||||
|
||||
this.setState({
|
||||
cert: res,
|
||||
cert: res.data,
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -65,7 +65,7 @@ class CertEditPage extends React.Component {
|
||||
OrganizationBackend.getOrganizations("admin")
|
||||
.then((res) => {
|
||||
this.setState({
|
||||
organizations: (res.msg === undefined) ? res : [],
|
||||
organizations: res.data || [],
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ class ChatEditPage extends React.Component {
|
||||
getChat() {
|
||||
ChatBackend.getChat("admin", this.state.chatName)
|
||||
.then((res) => {
|
||||
if (res === null) {
|
||||
if (res.data === null) {
|
||||
this.props.history.push("/404");
|
||||
return;
|
||||
}
|
||||
@ -51,7 +51,7 @@ class ChatEditPage extends React.Component {
|
||||
return;
|
||||
}
|
||||
this.setState({
|
||||
chat: res,
|
||||
chat: res.data,
|
||||
});
|
||||
|
||||
this.getUsers(res.organization);
|
||||
@ -62,7 +62,7 @@ class ChatEditPage extends React.Component {
|
||||
OrganizationBackend.getOrganizations("admin")
|
||||
.then((res) => {
|
||||
this.setState({
|
||||
organizations: (res.msg === undefined) ? res : [],
|
||||
organizations: res.data || [],
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -76,7 +76,7 @@ class ChatEditPage extends React.Component {
|
||||
}
|
||||
|
||||
this.setState({
|
||||
users: res,
|
||||
users: res.data,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -79,7 +79,8 @@ class ChatPage extends BaseListPage {
|
||||
|
||||
getMessages(chatName) {
|
||||
MessageBackend.getChatMessages(chatName)
|
||||
.then((messages) => {
|
||||
.then((res) => {
|
||||
const messages = res.data;
|
||||
this.setState({
|
||||
messages: messages,
|
||||
});
|
||||
@ -229,7 +230,7 @@ class ChatPage extends BaseListPage {
|
||||
</div>
|
||||
)
|
||||
}
|
||||
<ChatBox messages={this.state.messages} sendMessage={(text) => {this.sendMessage(text);}} account={this.props.account} />
|
||||
<ChatBox messages={this.state.messages || []} sendMessage={(text) => {this.sendMessage(text);}} account={this.props.account} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
@ -79,7 +79,9 @@ class EntryPage extends React.Component {
|
||||
Setting.showMessage("error", res.msg);
|
||||
return;
|
||||
}
|
||||
const themeData = res !== null ? Setting.getThemeData(res.organizationObj, res) : Conf.ThemeDefault;
|
||||
|
||||
const application = res.data;
|
||||
const themeData = application !== null ? Setting.getThemeData(application.organizationObj, application) : Conf.ThemeDefault;
|
||||
this.props.updataThemeData(themeData);
|
||||
});
|
||||
};
|
||||
|
@ -67,7 +67,7 @@ class GroupEditPage extends React.Component {
|
||||
.then((res) => {
|
||||
if (res.status === "ok") {
|
||||
this.setState({
|
||||
organizations: res.data,
|
||||
organizations: res.data || [],
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -55,7 +55,7 @@ class LdapEditPage extends React.Component {
|
||||
OrganizationBackend.getOrganizations("admin")
|
||||
.then((res) => {
|
||||
this.setState({
|
||||
organizations: (res.msg === undefined) ? res : [],
|
||||
organizations: res.data || [],
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ class MessageEditPage extends React.Component {
|
||||
getMessage() {
|
||||
MessageBackend.getMessage("admin", this.state.messageName)
|
||||
.then((res) => {
|
||||
if (res === null) {
|
||||
if (res.data === null) {
|
||||
this.props.history.push("/404");
|
||||
return;
|
||||
}
|
||||
@ -54,10 +54,10 @@ class MessageEditPage extends React.Component {
|
||||
Setting.showMessage("error", res.msg);
|
||||
return;
|
||||
}
|
||||
this.setState({
|
||||
message: res,
|
||||
});
|
||||
|
||||
this.setState({
|
||||
message: res.data,
|
||||
});
|
||||
this.getUsers(res.organization);
|
||||
});
|
||||
}
|
||||
@ -66,7 +66,7 @@ class MessageEditPage extends React.Component {
|
||||
OrganizationBackend.getOrganizations("admin")
|
||||
.then((res) => {
|
||||
this.setState({
|
||||
organizations: (res.msg === undefined) ? res : [],
|
||||
organizations: res.data || [],
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -87,8 +87,9 @@ class MessageEditPage extends React.Component {
|
||||
Setting.showMessage("error", res.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
users: res,
|
||||
users: res.data,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ class ModelEditPage extends React.Component {
|
||||
getModel() {
|
||||
ModelBackend.getModel(this.state.organizationName, this.state.modelName)
|
||||
.then((res) => {
|
||||
if (res === null) {
|
||||
if (res.data === null) {
|
||||
this.props.history.push("/404");
|
||||
return;
|
||||
}
|
||||
@ -59,7 +59,7 @@ class ModelEditPage extends React.Component {
|
||||
}
|
||||
|
||||
this.setState({
|
||||
model: res,
|
||||
model: res.data,
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -68,7 +68,7 @@ class ModelEditPage extends React.Component {
|
||||
OrganizationBackend.getOrganizations("admin")
|
||||
.then((res) => {
|
||||
this.setState({
|
||||
organizations: (res.msg === undefined) ? res : [],
|
||||
organizations: res.data || [],
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ class OrganizationEditPage extends React.Component {
|
||||
}
|
||||
|
||||
this.setState({
|
||||
applications: res,
|
||||
applications: res.data || [],
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -41,14 +41,14 @@ class PaymentEditPage extends React.Component {
|
||||
|
||||
getPayment() {
|
||||
PaymentBackend.getPayment("admin", this.state.paymentName)
|
||||
.then((payment) => {
|
||||
if (payment === null) {
|
||||
.then((res) => {
|
||||
if (res.data === null) {
|
||||
this.props.history.push("/404");
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
payment: payment,
|
||||
payment: res.data,
|
||||
});
|
||||
|
||||
Setting.scrollToDiv("invoice-area");
|
||||
|
@ -50,7 +50,9 @@ class PermissionEditPage extends React.Component {
|
||||
getPermission() {
|
||||
PermissionBackend.getPermission(this.state.organizationName, this.state.permissionName)
|
||||
.then((res) => {
|
||||
if (res === null) {
|
||||
const permission = res.data;
|
||||
|
||||
if (permission === null) {
|
||||
this.props.history.push("/404");
|
||||
return;
|
||||
}
|
||||
@ -61,14 +63,14 @@ class PermissionEditPage extends React.Component {
|
||||
}
|
||||
|
||||
this.setState({
|
||||
permission: res,
|
||||
permission: permission,
|
||||
});
|
||||
|
||||
this.getUsers(res.owner);
|
||||
this.getRoles(res.owner);
|
||||
this.getModels(res.owner);
|
||||
this.getResources(res.owner);
|
||||
this.getModel(res.owner, res.model);
|
||||
this.getUsers(permission.owner);
|
||||
this.getRoles(permission.owner);
|
||||
this.getModels(permission.owner);
|
||||
this.getResources(permission.owner);
|
||||
this.getModel(permission.owner, permission.model);
|
||||
});
|
||||
}
|
||||
|
||||
@ -76,7 +78,7 @@ class PermissionEditPage extends React.Component {
|
||||
OrganizationBackend.getOrganizations("admin")
|
||||
.then((res) => {
|
||||
this.setState({
|
||||
organizations: (res.msg === undefined) ? res : [],
|
||||
organizations: res.data || [],
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -88,8 +90,9 @@ class PermissionEditPage extends React.Component {
|
||||
Setting.showMessage("error", res.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
users: res,
|
||||
users: res.data,
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -101,8 +104,9 @@ class PermissionEditPage extends React.Component {
|
||||
Setting.showMessage("error", res.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
roles: res,
|
||||
roles: res.data,
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -114,21 +118,21 @@ class PermissionEditPage extends React.Component {
|
||||
Setting.showMessage("error", res.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
models: res,
|
||||
models: res.data,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
getModel(organizationName, modelName) {
|
||||
if (modelName === "") {
|
||||
return;
|
||||
}
|
||||
ModelBackend.getModel(organizationName, modelName)
|
||||
.then((res) => {
|
||||
if (res.status === "error") {
|
||||
Setting.showMessage("error", res.msg);
|
||||
return;
|
||||
}
|
||||
this.setState({
|
||||
model: res,
|
||||
model: res.data,
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -137,7 +141,7 @@ class PermissionEditPage extends React.Component {
|
||||
ApplicationBackend.getApplicationsByOrganization("admin", organizationName)
|
||||
.then((res) => {
|
||||
this.setState({
|
||||
resources: (res.msg === undefined) ? res : [],
|
||||
resources: res.data || [],
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -68,8 +68,9 @@ class PlanEditPage extends React.Component {
|
||||
Setting.showMessage("error", res.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
roles: res,
|
||||
roles: res.data,
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -81,8 +82,9 @@ class PlanEditPage extends React.Component {
|
||||
Setting.showMessage("error", res.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
users: res,
|
||||
users: res.data,
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -91,7 +93,7 @@ class PlanEditPage extends React.Component {
|
||||
OrganizationBackend.getOrganizations("admin")
|
||||
.then((res) => {
|
||||
this.setState({
|
||||
organizations: (res.msg === undefined) ? res : [],
|
||||
organizations: res.data || [],
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -44,13 +44,12 @@ class PricingEditPage extends React.Component {
|
||||
this.getPricing();
|
||||
this.getOrganizations();
|
||||
this.getApplicationsByOrganization(this.state.organizationName);
|
||||
this.getUserApplication();
|
||||
}
|
||||
|
||||
getPricing() {
|
||||
PricingBackend.getPricing(this.state.organizationName, this.state.pricingName)
|
||||
.then((res) => {
|
||||
if (res === null) {
|
||||
if (res.data === null) {
|
||||
this.props.history.push("/404");
|
||||
return;
|
||||
}
|
||||
@ -61,7 +60,7 @@ class PricingEditPage extends React.Component {
|
||||
}
|
||||
|
||||
this.setState({
|
||||
pricing: res,
|
||||
pricing: res.data,
|
||||
});
|
||||
this.getPlans(res.owner);
|
||||
});
|
||||
@ -74,8 +73,9 @@ class PricingEditPage extends React.Component {
|
||||
Setting.showMessage("error", res.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
plans: res,
|
||||
plans: res.data,
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -84,7 +84,16 @@ class PricingEditPage extends React.Component {
|
||||
OrganizationBackend.getOrganizations("admin")
|
||||
.then((res) => {
|
||||
this.setState({
|
||||
organizations: (res.msg === undefined) ? res : [],
|
||||
organizations: res.data || [],
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
getApplicationsByOrganization(organizationName) {
|
||||
ApplicationBackend.getApplicationsByOrganization("admin", organizationName)
|
||||
.then((res) => {
|
||||
this.setState({
|
||||
applications: res.data || [],
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -107,28 +116,6 @@ class PricingEditPage extends React.Component {
|
||||
});
|
||||
}
|
||||
|
||||
getApplicationsByOrganization(organizationName) {
|
||||
ApplicationBackend.getApplicationsByOrganization("admin", organizationName)
|
||||
.then((res) => {
|
||||
this.setState({
|
||||
applications: (res.msg === undefined) ? res : [],
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
getUserApplication() {
|
||||
ApplicationBackend.getUserApplication(this.state.organizationName, this.state.userName)
|
||||
.then((res) => {
|
||||
if (res.status === "error") {
|
||||
Setting.showMessage("error", res.msg);
|
||||
return;
|
||||
}
|
||||
this.setState({
|
||||
application: res,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
renderPricing() {
|
||||
return (
|
||||
<Card size="small" title={
|
||||
|
@ -48,7 +48,7 @@ class ProductBuyPage extends React.Component {
|
||||
}
|
||||
|
||||
this.setState({
|
||||
product: res,
|
||||
product: res.data,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ class ProductEditPage extends React.Component {
|
||||
OrganizationBackend.getOrganizations("admin")
|
||||
.then((res) => {
|
||||
this.setState({
|
||||
organizations: (res.msg === undefined) ? res : [],
|
||||
organizations: res.data || [],
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ class ProviderEditPage extends React.Component {
|
||||
getProvider() {
|
||||
ProviderBackend.getProvider(this.state.owner, this.state.providerName)
|
||||
.then((res) => {
|
||||
if (res === null) {
|
||||
if (res.data === null) {
|
||||
this.props.history.push("/404");
|
||||
return;
|
||||
}
|
||||
@ -72,7 +72,7 @@ class ProviderEditPage extends React.Component {
|
||||
OrganizationBackend.getOrganizations("admin")
|
||||
.then((res) => {
|
||||
this.setState({
|
||||
organizations: res.msg === undefined ? res : [],
|
||||
organizations: res.data || [],
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ class RoleEditPage extends React.Component {
|
||||
getRole() {
|
||||
RoleBackend.getRole(this.state.organizationName, this.state.roleName)
|
||||
.then((res) => {
|
||||
if (res === null) {
|
||||
if (res.data === null) {
|
||||
this.props.history.push("/404");
|
||||
return;
|
||||
}
|
||||
@ -53,7 +53,7 @@ class RoleEditPage extends React.Component {
|
||||
}
|
||||
|
||||
this.setState({
|
||||
role: res,
|
||||
role: res.data,
|
||||
});
|
||||
|
||||
this.getUsers(res.owner);
|
||||
@ -65,7 +65,7 @@ class RoleEditPage extends React.Component {
|
||||
OrganizationBackend.getOrganizations("admin")
|
||||
.then((res) => {
|
||||
this.setState({
|
||||
organizations: (res.msg === undefined) ? res : [],
|
||||
organizations: res.data || [],
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -77,8 +77,9 @@ class RoleEditPage extends React.Component {
|
||||
Setting.showMessage("error", res.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
users: res,
|
||||
users: res.data,
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -90,8 +91,9 @@ class RoleEditPage extends React.Component {
|
||||
Setting.showMessage("error", res.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
roles: res,
|
||||
roles: res.data,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ class SubscriptionEditPage extends React.Component {
|
||||
getSubscription() {
|
||||
SubscriptionBackend.getSubscription(this.state.organizationName, this.state.subscriptionName)
|
||||
.then((res) => {
|
||||
if (res === null) {
|
||||
if (res.data === null) {
|
||||
this.props.history.push("/404");
|
||||
return;
|
||||
}
|
||||
@ -58,7 +58,7 @@ class SubscriptionEditPage extends React.Component {
|
||||
}
|
||||
|
||||
this.setState({
|
||||
subscription: res,
|
||||
subscription: res.data,
|
||||
});
|
||||
|
||||
this.getUsers(res.owner);
|
||||
@ -70,7 +70,7 @@ class SubscriptionEditPage extends React.Component {
|
||||
PlanBackend.getPlans(organizationName)
|
||||
.then((res) => {
|
||||
this.setState({
|
||||
planes: res,
|
||||
planes: res.data,
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -82,8 +82,9 @@ class SubscriptionEditPage extends React.Component {
|
||||
Setting.showMessage("error", res.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
users: res,
|
||||
users: res.data,
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -92,7 +93,7 @@ class SubscriptionEditPage extends React.Component {
|
||||
OrganizationBackend.getOrganizations("admin")
|
||||
.then((res) => {
|
||||
this.setState({
|
||||
organizations: (res.msg === undefined) ? res : [],
|
||||
organizations: res.data || [],
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ class SyncerEditPage extends React.Component {
|
||||
getSyncer() {
|
||||
SyncerBackend.getSyncer("admin", this.state.syncerName)
|
||||
.then((res) => {
|
||||
if (res === null) {
|
||||
if (res.data === null) {
|
||||
this.props.history.push("/404");
|
||||
return;
|
||||
}
|
||||
@ -59,7 +59,7 @@ class SyncerEditPage extends React.Component {
|
||||
}
|
||||
|
||||
this.setState({
|
||||
syncer: res,
|
||||
syncer: res.data,
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -68,7 +68,7 @@ class SyncerEditPage extends React.Component {
|
||||
OrganizationBackend.getOrganizations("admin")
|
||||
.then((res) => {
|
||||
this.setState({
|
||||
organizations: (res.msg === undefined) ? res : [],
|
||||
organizations: res.data || [],
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ class TokenEditPage extends React.Component {
|
||||
getToken() {
|
||||
TokenBackend.getToken("admin", this.state.tokenName)
|
||||
.then((res) => {
|
||||
if (res === null) {
|
||||
if (res.data === null) {
|
||||
this.props.history.push("/404");
|
||||
return;
|
||||
}
|
||||
@ -47,7 +47,7 @@ class TokenEditPage extends React.Component {
|
||||
}
|
||||
|
||||
this.setState({
|
||||
token: res,
|
||||
token: res.data,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -75,19 +75,20 @@ class UserEditPage extends React.Component {
|
||||
|
||||
getUser() {
|
||||
UserBackend.getUser(this.state.organizationName, this.state.userName)
|
||||
.then((data) => {
|
||||
if (data === null) {
|
||||
.then((res) => {
|
||||
if (res.data === null) {
|
||||
this.props.history.push("/404");
|
||||
return;
|
||||
}
|
||||
|
||||
if (data.status === null || data.status !== "error") {
|
||||
this.setState({
|
||||
user: data,
|
||||
multiFactorAuths: data?.multiFactorAuths ?? [],
|
||||
});
|
||||
if (res.status === "error") {
|
||||
Setting.showMessage("error", res.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
user: res.data,
|
||||
multiFactorAuths: res.data?.multiFactorAuths ?? [],
|
||||
loading: false,
|
||||
});
|
||||
});
|
||||
@ -108,7 +109,7 @@ class UserEditPage extends React.Component {
|
||||
OrganizationBackend.getOrganizations("admin")
|
||||
.then((res) => {
|
||||
this.setState({
|
||||
organizations: (res.msg === undefined) ? res : [],
|
||||
organizations: res.data || [],
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -117,7 +118,7 @@ class UserEditPage extends React.Component {
|
||||
ApplicationBackend.getApplicationsByOrganization("admin", organizationName)
|
||||
.then((res) => {
|
||||
this.setState({
|
||||
applications: (res.msg === undefined) ? res : [],
|
||||
applications: res.data || [],
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -129,12 +130,10 @@ class UserEditPage extends React.Component {
|
||||
Setting.showMessage("error", res.msg);
|
||||
return;
|
||||
}
|
||||
this.setState({
|
||||
application: res,
|
||||
});
|
||||
|
||||
this.setState({
|
||||
isGroupsVisible: res.organizationObj.accountItems?.some((item) => item.name === "Groups" && item.visible),
|
||||
application: res.data,
|
||||
isGroupsVisible: res.data?.organizationObj.accountItems?.some((item) => item.name === "Groups" && item.visible),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -122,14 +122,14 @@ class WebhookEditPage extends React.Component {
|
||||
|
||||
getWebhook() {
|
||||
WebhookBackend.getWebhook("admin", this.state.webhookName)
|
||||
.then((webhook) => {
|
||||
if (webhook === null) {
|
||||
.then((res) => {
|
||||
if (res.data === null) {
|
||||
this.props.history.push("/404");
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
webhook: webhook,
|
||||
webhook: res.data,
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -138,7 +138,7 @@ class WebhookEditPage extends React.Component {
|
||||
OrganizationBackend.getOrganizations("admin")
|
||||
.then((res) => {
|
||||
this.setState({
|
||||
organizations: (res.msg === undefined) ? res : [],
|
||||
organizations: res.data || [],
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ class ForgetPage extends React.Component {
|
||||
Setting.showMessage("error", res.msg);
|
||||
return;
|
||||
}
|
||||
this.onUpdateApplication(res);
|
||||
this.onUpdateApplication(res.data);
|
||||
});
|
||||
}
|
||||
getApplicationObj() {
|
||||
|
@ -170,7 +170,7 @@ class LoginPage extends React.Component {
|
||||
Setting.showMessage("error", res.msg);
|
||||
return;
|
||||
}
|
||||
this.onUpdateApplication(res);
|
||||
this.onUpdateApplication(res.data);
|
||||
});
|
||||
} else {
|
||||
OrganizationBackend.getDefaultApplication("admin", this.state.owner)
|
||||
|
@ -69,7 +69,7 @@ class MfaSetupPage extends React.Component {
|
||||
return;
|
||||
}
|
||||
this.setState({
|
||||
application: res,
|
||||
application: res.data,
|
||||
});
|
||||
} else {
|
||||
Setting.showMessage("error", i18next.t("mfa:Failed to get application"));
|
||||
|
@ -63,7 +63,7 @@ class PromptPage extends React.Component {
|
||||
}
|
||||
|
||||
this.setState({
|
||||
user: res,
|
||||
user: res.data,
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -80,9 +80,9 @@ class PromptPage extends React.Component {
|
||||
return;
|
||||
}
|
||||
|
||||
this.onUpdateApplication(res);
|
||||
this.onUpdateApplication(res.data);
|
||||
this.setState({
|
||||
application: res,
|
||||
application: res.data,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -48,9 +48,10 @@ class ResultPage extends React.Component {
|
||||
Setting.showMessage("error", res.msg);
|
||||
return;
|
||||
}
|
||||
this.onUpdateApplication(res);
|
||||
|
||||
this.onUpdateApplication(res.data);
|
||||
this.setState({
|
||||
application: res,
|
||||
application: res.data,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ class SignupPage extends React.Component {
|
||||
return;
|
||||
}
|
||||
|
||||
this.onUpdateApplication(res);
|
||||
this.onUpdateApplication(res.data);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ class HomePage extends React.Component {
|
||||
ApplicationBackend.getApplicationsByOrganization("admin", organizationName)
|
||||
.then((res) => {
|
||||
this.setState({
|
||||
applications: (res.msg === undefined) ? res : [],
|
||||
applications: res.data || [],
|
||||
});
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user