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