mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 05:10:19 +08:00
feat: show 404 error for non-existent objects in edit pages
This commit is contained in:
@ -50,6 +50,11 @@ class AdapterEditPage extends React.Component {
|
|||||||
AdapterBackend.getAdapter("admin", this.state.adapterName)
|
AdapterBackend.getAdapter("admin", this.state.adapterName)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.status === "ok") {
|
if (res.status === "ok") {
|
||||||
|
if (res.data === null) {
|
||||||
|
this.props.history.push("/404");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
adapter: res.data,
|
adapter: res.data,
|
||||||
});
|
});
|
||||||
|
@ -119,6 +119,11 @@ class ApplicationEditPage extends React.Component {
|
|||||||
getApplication() {
|
getApplication() {
|
||||||
ApplicationBackend.getApplication("admin", this.state.applicationName)
|
ApplicationBackend.getApplication("admin", this.state.applicationName)
|
||||||
.then((application) => {
|
.then((application) => {
|
||||||
|
if (application === null) {
|
||||||
|
this.props.history.push("/404");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (application.grantTypes === null || application.grantTypes === undefined || application.grantTypes.length === 0) {
|
if (application.grantTypes === null || application.grantTypes === undefined || application.grantTypes.length === 0) {
|
||||||
application.grantTypes = ["authorization_code"];
|
application.grantTypes = ["authorization_code"];
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,11 @@ class CertEditPage extends React.Component {
|
|||||||
getCert() {
|
getCert() {
|
||||||
CertBackend.getCert(this.state.owner, this.state.certName)
|
CertBackend.getCert(this.state.owner, this.state.certName)
|
||||||
.then((cert) => {
|
.then((cert) => {
|
||||||
|
if (cert === null) {
|
||||||
|
this.props.history.push("/404");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
cert: cert,
|
cert: cert,
|
||||||
});
|
});
|
||||||
|
@ -41,6 +41,11 @@ class ChatEditPage extends React.Component {
|
|||||||
getChat() {
|
getChat() {
|
||||||
ChatBackend.getChat("admin", this.state.chatName)
|
ChatBackend.getChat("admin", this.state.chatName)
|
||||||
.then((chat) => {
|
.then((chat) => {
|
||||||
|
if (chat === null) {
|
||||||
|
this.props.history.push("/404");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
chat: chat,
|
chat: chat,
|
||||||
});
|
});
|
||||||
|
@ -46,6 +46,11 @@ class MessageEditPage extends React.Component {
|
|||||||
getMessage() {
|
getMessage() {
|
||||||
MessageBackend.getMessage("admin", this.state.messageName)
|
MessageBackend.getMessage("admin", this.state.messageName)
|
||||||
.then((message) => {
|
.then((message) => {
|
||||||
|
if (message === null) {
|
||||||
|
this.props.history.push("/404");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
message: message,
|
message: message,
|
||||||
});
|
});
|
||||||
|
@ -48,6 +48,11 @@ class ModelEditPage extends React.Component {
|
|||||||
getModel() {
|
getModel() {
|
||||||
ModelBackend.getModel(this.state.organizationName, this.state.modelName)
|
ModelBackend.getModel(this.state.organizationName, this.state.modelName)
|
||||||
.then((model) => {
|
.then((model) => {
|
||||||
|
if (model === null) {
|
||||||
|
this.props.history.push("/404");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
model: model,
|
model: model,
|
||||||
});
|
});
|
||||||
|
@ -50,6 +50,11 @@ class OrganizationEditPage extends React.Component {
|
|||||||
getOrganization() {
|
getOrganization() {
|
||||||
OrganizationBackend.getOrganization("admin", this.state.organizationName)
|
OrganizationBackend.getOrganization("admin", this.state.organizationName)
|
||||||
.then((organization) => {
|
.then((organization) => {
|
||||||
|
if (organization === null) {
|
||||||
|
this.props.history.push("/404");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
organization: organization,
|
organization: organization,
|
||||||
});
|
});
|
||||||
|
@ -42,6 +42,11 @@ class PaymentEditPage extends React.Component {
|
|||||||
getPayment() {
|
getPayment() {
|
||||||
PaymentBackend.getPayment("admin", this.state.paymentName)
|
PaymentBackend.getPayment("admin", this.state.paymentName)
|
||||||
.then((payment) => {
|
.then((payment) => {
|
||||||
|
if (payment === null) {
|
||||||
|
this.props.history.push("/404");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
payment: payment,
|
payment: payment,
|
||||||
});
|
});
|
||||||
|
@ -50,6 +50,11 @@ class PermissionEditPage extends React.Component {
|
|||||||
getPermission() {
|
getPermission() {
|
||||||
PermissionBackend.getPermission(this.state.organizationName, this.state.permissionName)
|
PermissionBackend.getPermission(this.state.organizationName, this.state.permissionName)
|
||||||
.then((permission) => {
|
.then((permission) => {
|
||||||
|
if (permission === null) {
|
||||||
|
this.props.history.push("/404");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
permission: permission,
|
permission: permission,
|
||||||
});
|
});
|
||||||
|
@ -47,6 +47,11 @@ class PlanEditPage extends React.Component {
|
|||||||
getPlan() {
|
getPlan() {
|
||||||
PlanBackend.getPlan(this.state.organizationName, this.state.planName)
|
PlanBackend.getPlan(this.state.organizationName, this.state.planName)
|
||||||
.then((plan) => {
|
.then((plan) => {
|
||||||
|
if (plan === null) {
|
||||||
|
this.props.history.push("/404");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
plan: plan,
|
plan: plan,
|
||||||
});
|
});
|
||||||
|
@ -50,6 +50,11 @@ class PricingEditPage extends React.Component {
|
|||||||
getPricing() {
|
getPricing() {
|
||||||
PricingBackend.getPricing(this.state.organizationName, this.state.pricingName)
|
PricingBackend.getPricing(this.state.organizationName, this.state.pricingName)
|
||||||
.then((pricing) => {
|
.then((pricing) => {
|
||||||
|
if (pricing === null) {
|
||||||
|
this.props.history.push("/404");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
pricing: pricing,
|
pricing: pricing,
|
||||||
});
|
});
|
||||||
|
@ -45,6 +45,11 @@ class ProductEditPage extends React.Component {
|
|||||||
getProduct() {
|
getProduct() {
|
||||||
ProductBackend.getProduct(this.props.account.owner, this.state.productName)
|
ProductBackend.getProduct(this.props.account.owner, this.state.productName)
|
||||||
.then((product) => {
|
.then((product) => {
|
||||||
|
if (product === null) {
|
||||||
|
this.props.history.push("/404");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
product: product,
|
product: product,
|
||||||
});
|
});
|
||||||
|
@ -50,6 +50,11 @@ class ProviderEditPage extends React.Component {
|
|||||||
getProvider() {
|
getProvider() {
|
||||||
ProviderBackend.getProvider(this.state.owner, this.state.providerName)
|
ProviderBackend.getProvider(this.state.owner, this.state.providerName)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
if (res === null) {
|
||||||
|
this.props.history.push("/404");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (res.status === "ok") {
|
if (res.status === "ok") {
|
||||||
this.setState({
|
this.setState({
|
||||||
provider: res.data,
|
provider: res.data,
|
||||||
|
@ -43,6 +43,11 @@ class RoleEditPage extends React.Component {
|
|||||||
getRole() {
|
getRole() {
|
||||||
RoleBackend.getRole(this.state.organizationName, this.state.roleName)
|
RoleBackend.getRole(this.state.organizationName, this.state.roleName)
|
||||||
.then((role) => {
|
.then((role) => {
|
||||||
|
if (role === null) {
|
||||||
|
this.props.history.push("/404");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
role: role,
|
role: role,
|
||||||
});
|
});
|
||||||
|
@ -47,6 +47,11 @@ class SubscriptionEditPage extends React.Component {
|
|||||||
getSubscription() {
|
getSubscription() {
|
||||||
SubscriptionBackend.getSubscription(this.state.organizationName, this.state.subscriptionName)
|
SubscriptionBackend.getSubscription(this.state.organizationName, this.state.subscriptionName)
|
||||||
.then((subscription) => {
|
.then((subscription) => {
|
||||||
|
if (subscription === null) {
|
||||||
|
this.props.history.push("/404");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
subscription: subscription,
|
subscription: subscription,
|
||||||
});
|
});
|
||||||
|
@ -48,6 +48,11 @@ class SyncerEditPage extends React.Component {
|
|||||||
getSyncer() {
|
getSyncer() {
|
||||||
SyncerBackend.getSyncer("admin", this.state.syncerName)
|
SyncerBackend.getSyncer("admin", this.state.syncerName)
|
||||||
.then((syncer) => {
|
.then((syncer) => {
|
||||||
|
if (syncer === null) {
|
||||||
|
this.props.history.push("/404");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
syncer: syncer,
|
syncer: syncer,
|
||||||
});
|
});
|
||||||
|
@ -36,6 +36,11 @@ class TokenEditPage extends React.Component {
|
|||||||
getToken() {
|
getToken() {
|
||||||
TokenBackend.getToken("admin", this.state.tokenName)
|
TokenBackend.getToken("admin", this.state.tokenName)
|
||||||
.then((token) => {
|
.then((token) => {
|
||||||
|
if (token === null) {
|
||||||
|
this.props.history.push("/404");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
token: token,
|
token: token,
|
||||||
});
|
});
|
||||||
|
@ -66,6 +66,11 @@ class UserEditPage extends React.Component {
|
|||||||
getUser() {
|
getUser() {
|
||||||
UserBackend.getUser(this.state.organizationName, this.state.userName)
|
UserBackend.getUser(this.state.organizationName, this.state.userName)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
|
if (data === null) {
|
||||||
|
this.props.history.push("/404");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (data.status === null || data.status !== "error") {
|
if (data.status === null || data.status !== "error") {
|
||||||
this.setState({
|
this.setState({
|
||||||
user: data,
|
user: data,
|
||||||
|
@ -123,6 +123,11 @@ class WebhookEditPage extends React.Component {
|
|||||||
getWebhook() {
|
getWebhook() {
|
||||||
WebhookBackend.getWebhook("admin", this.state.webhookName)
|
WebhookBackend.getWebhook("admin", this.state.webhookName)
|
||||||
.then((webhook) => {
|
.then((webhook) => {
|
||||||
|
if (webhook === null) {
|
||||||
|
this.props.history.push("/404");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
webhook: webhook,
|
webhook: webhook,
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user