diff --git a/web/src/ChatEditPage.js b/web/src/ChatEditPage.js index 16fdaff..cdd53a0 100644 --- a/web/src/ChatEditPage.js +++ b/web/src/ChatEditPage.js @@ -38,13 +38,13 @@ class ChatEditPage extends React.Component { getChat() { ChatBackend.getChat(this.props.account.name, this.state.chatName) - .then((chat) => { - if (chat.status === "ok") { + .then((res) => { + if (res.status === "ok") { this.setState({ - chat: chat.data, + chat: res.data, }); } else { - Setting.showMessage("error", `Failed to get chat: ${chat.msg}`); + Setting.showMessage("error", `Failed to get chat: ${res.msg}`); } }); } diff --git a/web/src/ClusteringPage.js b/web/src/ClusteringPage.js index 865d5da..85a9e63 100644 --- a/web/src/ClusteringPage.js +++ b/web/src/ClusteringPage.js @@ -1,17 +1,17 @@ -// Copyright 2023 The casbin Authors. All Rights Reserved. -// -// Licensed 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. - +// Copyright 2023 The casbin Authors. All Rights Reserved. +// +// Licensed 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 React from "react"; import * as Conf from "./Conf"; import * as WordsetBackend from "./backend/WordsetBackend"; @@ -33,11 +33,11 @@ class ClusteringPage extends React.Component { getWordset() { WordsetBackend.getWordset(Conf.DefaultOwner, Conf.DefaultWordsetName) - .then((wordset) => { - if (wordset.status === "ok") { - this.setState({wordset: wordset.data}); + .then((res) => { + if (res.status === "ok") { + this.setState({wordset: res.data}); } else { - Setting.showMessage("error", `Failed to get wordset: ${wordset.msg}`); + Setting.showMessage("error", `Failed to get wordset: ${res.msg}`); } }); } diff --git a/web/src/FactorsetEditPage.js b/web/src/FactorsetEditPage.js index f00f2a5..73a860e 100644 --- a/web/src/FactorsetEditPage.js +++ b/web/src/FactorsetEditPage.js @@ -36,13 +36,13 @@ class FactorsetEditPage extends React.Component { getFactorset() { FactorsetBackend.getFactorset(this.props.account.name, this.state.factorsetName) - .then((factorset) => { - if (factorset.status === "ok") { + .then((res) => { + if (res.status === "ok") { this.setState({ - factorset: factorset.data, + factorset: res.data, }); } else { - Setting.showMessage("error", `Failed to get factorset: ${factorset.msg}`); + Setting.showMessage("error", `Failed to get factorset: ${res.msg}`); } }); } diff --git a/web/src/FileTreePage.js b/web/src/FileTreePage.js index 152dd32..96910bf 100644 --- a/web/src/FileTreePage.js +++ b/web/src/FileTreePage.js @@ -36,17 +36,17 @@ class FileTreePage extends React.Component { getStore() { StoreBackend.getStore(this.state.owner, this.state.storeName) - .then((store) => { - if (store.status === "ok") { - if (store.data2 !== null && store.data?.includes("error")) { - store.data.error = store.data2; + .then((res) => { + if (res.status === "ok") { + if (res.data2 !== null && res.data?.includes("error")) { + res.data.error = res.data2; } this.setState({ - store: store.data, + store: res.data, }); } else { - Setting.showMessage("error", `Failed to get store: ${store.msg}`); + Setting.showMessage("error", `Failed to get store: ${res.msg}`); } }); } diff --git a/web/src/HomePage.js b/web/src/HomePage.js index 809e829..1d8d11d 100644 --- a/web/src/HomePage.js +++ b/web/src/HomePage.js @@ -33,17 +33,17 @@ class HomePage extends React.Component { getStore() { StoreBackend.getStore("admin", "_casibase_default_store_") - .then((store) => { - if (store.status === "ok") { - if (store.data2 !== null && store.data2.includes("error")) { - store.data.error = store.data2; + .then((res) => { + if (res.status === "ok") { + if (res.data2 !== null && res.data2.includes("error")) { + res.data.error = res.data2; } this.setState({ - store: store.data, + store: res.data, }); } else { - Setting.showMessage("error", `Failed to get store: ${store.msg}`); + Setting.showMessage("error", `Failed to get store: ${res.msg}`); } }); } diff --git a/web/src/MessageEditPage.js b/web/src/MessageEditPage.js index c2ad0d4..0af8428 100644 --- a/web/src/MessageEditPage.js +++ b/web/src/MessageEditPage.js @@ -42,52 +42,52 @@ class MessageEditPage extends React.Component { getChats() { ChatBackend.getChats(this.props.account.name) - .then((chats) => { - if (chats.status === "ok") { + .then((res) => { + if (res.status === "ok") { this.setState({ - chats: chats.data, + chats: res.data, }); } else { - Setting.showMessage("error", `Failed to get chat: ${chats.msg}`); + Setting.showMessage("error", `Failed to get chat: ${res.msg}`); } }); } getChat(chatName) { ChatBackend.getChat(this.props.account.name, chatName) - .then((chat) => { - if (chat.status === "ok") { + .then((res) => { + if (res.status === "ok") { this.setState({ - chat: chat.data, + chat: res.data, }); } else { - Setting.showMessage("error", `Failed to get chat: ${chat.msg}`); + Setting.showMessage("error", `Failed to get chat: ${res.msg}`); } }); } getMessage() { MessageBackend.getMessage(this.props.account.name, this.state.messageName) - .then((message) => { - if (message.status === "ok") { + .then((res) => { + if (res.status === "ok") { this.setState({ - message: message.data, + message: res.data, }); } else { - Setting.showMessage("error", `Failed to get message: ${message.msg}`); + Setting.showMessage("error", `Failed to get message: ${res.msg}`); } }); } getMessages() { MessageBackend.getMessages(this.props.account.name) - .then((messages) => { - if (messages.status === "ok") { + .then((res) => { + if (res.status === "ok") { this.setState({ - messages: messages.data, + messages: res.data, }); } else { - Setting.showMessage("error", `Failed to get messages: ${messages.msg}`); + Setting.showMessage("error", `Failed to get messages: ${res.msg}`); } }); } diff --git a/web/src/ProviderEditPage.js b/web/src/ProviderEditPage.js index 76dfe7e..6f98a59 100644 --- a/web/src/ProviderEditPage.js +++ b/web/src/ProviderEditPage.js @@ -37,13 +37,13 @@ class ProviderEditPage extends React.Component { getProvider() { ProviderBackend.getProvider(this.props.account.name, this.state.providerName) - .then((provider) => { - if (provider.status === "ok") { + .then((res) => { + if (res.status === "ok") { this.setState({ - provider: provider.data, + provider: res.data, }); } else { - Setting.showMessage("error", `Failed to get provider: ${provider.msg}`); + Setting.showMessage("error", `Failed to get provider: ${res.msg}`); } }); } diff --git a/web/src/StoreEditPage.js b/web/src/StoreEditPage.js index 5758fa0..0002917 100644 --- a/web/src/StoreEditPage.js +++ b/web/src/StoreEditPage.js @@ -36,17 +36,17 @@ class StoreEditPage extends React.Component { getStore() { StoreBackend.getStore(this.state.owner, this.state.storeName) - .then((store) => { - if (store.status === "ok") { - if (store.data2 !== null && store.data2.includes("error")) { - store.data.error = store.data2; + .then((res) => { + if (res.status === "ok") { + if (res.data2 !== null && res.data2.includes("error")) { + res.data.error = res.data2; } this.setState({ - store: store.data, + store: res.data, }); } else { - Setting.showMessage("error", `Failed to get store: ${store.msg}`); + Setting.showMessage("error", `Failed to get store: ${res.msg}`); } }); } diff --git a/web/src/VectorEditPage.js b/web/src/VectorEditPage.js index da1ea99..5bbd7e6 100644 --- a/web/src/VectorEditPage.js +++ b/web/src/VectorEditPage.js @@ -34,13 +34,13 @@ class VectorEditPage extends React.Component { getVector() { VectorBackend.getVector(this.props.account.name, this.state.vectorName) - .then((vector) => { - if (vector.status === "ok") { + .then((res) => { + if (res.status === "ok") { this.setState({ - vector: vector.data, + vector: res.data, }); } else { - Setting.showMessage("error", `Failed to get vector: ${vector.msg}`); + Setting.showMessage("error", `Failed to get vector: ${res.msg}`); } }); } diff --git a/web/src/VideoEditPage.js b/web/src/VideoEditPage.js index 4d0c729..b29c0f0 100644 --- a/web/src/VideoEditPage.js +++ b/web/src/VideoEditPage.js @@ -47,18 +47,18 @@ class VideoEditPage extends React.Component { getVideo() { VideoBackend.getVideo(this.props.account.name, this.state.videoName) - .then((video) => { - if (video.status === "ok") { + .then((res) => { + if (res.status === "ok") { this.setState({ - video: video.data, + video: res.data, currentTime: 0, }); - if (video.dataUrl !== "") { - this.getDataAndParse(video.dataUrl); + if (res.dataUrl !== "") { + this.getDataAndParse(res.dataUrl); } } else { - Setting.showMessage("error", `Failed to get video: ${video.msg}`); + Setting.showMessage("error", `Failed to get video: ${res.msg}`); } }); } diff --git a/web/src/WordsetEditPage.js b/web/src/WordsetEditPage.js index 7dc7517..2bd2e5a 100644 --- a/web/src/WordsetEditPage.js +++ b/web/src/WordsetEditPage.js @@ -42,13 +42,13 @@ class WordsetEditPage extends React.Component { getWordset() { WordsetBackend.getWordset(this.props.account.name, this.state.wordsetName) - .then((wordset) => { - if (wordset.status === "ok") { + .then((res) => { + if (res.status === "ok") { this.setState({ - wordset: wordset.data, + wordset: res.data, }); } else { - Setting.showMessage("error", `Failed to get wordset: ${wordset.msg}`); + Setting.showMessage("error", `Failed to get wordset: ${res.msg}`); } }); } @@ -136,14 +136,14 @@ class WordsetEditPage extends React.Component { matchLoading: true, }); WordsetBackend.getWordsetMatch(this.props.account.name, this.state.wordsetName) - .then((wordset) => { - if (wordset.status === "ok") { + .then((res) => { + if (res.status === "ok") { this.setState({ - wordset: wordset.data, + wordset: res.data, matchLoading: false, }); } else { - Setting.showMessage("error", `Failed to get wordset: ${wordset.msg}`); + Setting.showMessage("error", `Failed to get wordset: ${res.msg}`); } }); }}>{i18next.t("wordset:Match")} diff --git a/web/src/WordsetGraph.js b/web/src/WordsetGraph.js index 07b5f48..ca553c8 100644 --- a/web/src/WordsetGraph.js +++ b/web/src/WordsetGraph.js @@ -84,17 +84,17 @@ class WordsetGraph extends React.Component { loading: true, }); WordsetBackend.getWordsetGraph("admin", this.state.wordsetName, this.state.clusterNumber, this.state.distanceLimit) - .then((graph) => { - if (graph.status === "ok") { + .then((res) => { + if (res.status === "ok") { this.setState({ - graph: graph.data, + graph: res.data, loading: false, selectedType: null, selectedId: null, selectedIds: [], }); } else { - Setting.showMessage("error", `Failed to get wordset graph: ${graph.msg}`); + Setting.showMessage("error", `Failed to get wordset graph: ${res.msg}`); } }); } diff --git a/web/src/WordsetGraphPage.js b/web/src/WordsetGraphPage.js index 20a5c05..d9b4871 100644 --- a/web/src/WordsetGraphPage.js +++ b/web/src/WordsetGraphPage.js @@ -1,17 +1,17 @@ -// Copyright 2023 The casbin Authors. All Rights Reserved. -// -// Licensed 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. - +// Copyright 2023 The casbin Authors. All Rights Reserved. +// +// Licensed 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 React from "react"; import * as WordsetBackend from "./backend/WordsetBackend"; import WordsetGraph from "./WordsetGraph"; @@ -33,13 +33,13 @@ class WordsetGraphPage extends React.Component { getWordset() { WordsetBackend.getWordset(this.props.account.name, this.state.wordsetName) - .then((wordset) => { - if (wordset.status === "ok") { + .then((res) => { + if (res.status === "ok") { this.setState({ - wordset: wordset.data, + wordset: res.data, }); } else { - Setting.showMessage("error", `Failed to get wordset: ${wordset.msg}`); + Setting.showMessage("error", `Failed to get wordset: ${res.msg}`); } }); }