diff options
Diffstat (limited to 'web/source/settings/components')
-rw-r--r-- | web/source/settings/components/authorization/index.tsx (renamed from web/source/settings/components/authorization/index.jsx) | 30 | ||||
-rw-r--r-- | web/source/settings/components/authorization/login.tsx (renamed from web/source/settings/components/authorization/login.jsx) | 33 | ||||
-rw-r--r-- | web/source/settings/components/back-button.jsx | 2 | ||||
-rw-r--r-- | web/source/settings/components/check-list.jsx | 2 | ||||
-rw-r--r-- | web/source/settings/components/combo-box.jsx | 2 | ||||
-rw-r--r-- | web/source/settings/components/error.jsx | 2 | ||||
-rw-r--r-- | web/source/settings/components/fake-profile.jsx | 2 | ||||
-rw-r--r-- | web/source/settings/components/fake-toot.jsx | 2 | ||||
-rw-r--r-- | web/source/settings/components/form/inputs.jsx | 2 | ||||
-rw-r--r-- | web/source/settings/components/form/mutation-button.jsx | 2 | ||||
-rw-r--r-- | web/source/settings/components/languages.jsx | 2 | ||||
-rw-r--r-- | web/source/settings/components/loading.jsx | 2 | ||||
-rw-r--r-- | web/source/settings/components/user-logout-card.jsx | 2 |
13 files changed, 35 insertions, 50 deletions
diff --git a/web/source/settings/components/authorization/index.jsx b/web/source/settings/components/authorization/index.tsx index d38e160da..321bb03eb 100644 --- a/web/source/settings/components/authorization/index.jsx +++ b/web/source/settings/components/authorization/index.tsx @@ -17,23 +17,25 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -"use strict"; +import { useVerifyCredentialsQuery } from "../../lib/query/oauth"; +import { store } from "../../redux/store"; -const React = require("react"); -const Redux = require("react-redux"); +import React from "react"; -const query = require("../../lib/query"); +import Login from "./login"; +import Loading from "../loading"; +import { Error } from "../error"; -const Login = require("./login"); -const Loading = require("../loading"); -const { Error } = require("../error"); +export function Authorization({ App }) { + const { loginState, expectingRedirect } = store.getState().oauth; + const skip = (loginState == "none" || loginState == "logout" || expectingRedirect); -module.exports = function Authorization({ App }) { - const { loginState, expectingRedirect } = Redux.useSelector((state) => state.oauth); - - const { isLoading, isSuccess, data: account, error } = query.useVerifyCredentialsQuery(undefined, { - skip: loginState == "none" || loginState == "logout" || expectingRedirect - }); + const { + isLoading, + isSuccess, + data: account, + error, + } = useVerifyCredentialsQuery(null, { skip: skip }); let showLogin = true; let content = null; @@ -73,4 +75,4 @@ module.exports = function Authorization({ App }) { </section> ); } -};
\ No newline at end of file +} diff --git a/web/source/settings/components/authorization/login.jsx b/web/source/settings/components/authorization/login.tsx index dbeb6c047..76bfccf43 100644 --- a/web/source/settings/components/authorization/login.jsx +++ b/web/source/settings/components/authorization/login.tsx @@ -17,18 +17,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -"use strict"; +import React from "react"; -const React = require("react"); +import { useAuthorizeFlowMutation } from "../../lib/query/oauth"; +import { useTextInput, useValue } from "../../lib/form"; +import useFormSubmit from "../../lib/form/submit"; +import { TextInput } from "../form/inputs"; +import MutationButton from "../form/mutation-button"; +import Loading from "../loading"; -const query = require("../../lib/query"); -const { useTextInput, useValue } = require("../../lib/form"); -const useFormSubmit = require("../../lib/form/submit"); -const { TextInput } = require("../form/inputs"); -const MutationButton = require("../form/mutation-button"); -const Loading = require("../loading"); - -module.exports = function Login({ }) { +export default function Login({ }) { const form = { instance: useTextInput("instance", { defaultValue: window.location.origin @@ -38,8 +36,11 @@ module.exports = function Login({ }) { const [formSubmit, result] = useFormSubmit( form, - query.useAuthorizeFlowMutation(), - { changedOnly: false } + useAuthorizeFlowMutation(), + { + changedOnly: false, + onFinish: undefined, + } ); if (result.isLoading) { @@ -63,7 +64,11 @@ module.exports = function Login({ }) { label="Instance" name="instance" /> - <MutationButton label="Login" result={result} /> + <MutationButton + label="Login" + result={result} + disabled={false} + /> </form> ); -};
\ No newline at end of file +}
\ No newline at end of file diff --git a/web/source/settings/components/back-button.jsx b/web/source/settings/components/back-button.jsx index 13a7a757b..05306e2ea 100644 --- a/web/source/settings/components/back-button.jsx +++ b/web/source/settings/components/back-button.jsx @@ -17,8 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -"use strict"; - const React = require("react"); const { Link } = require("wouter"); diff --git a/web/source/settings/components/check-list.jsx b/web/source/settings/components/check-list.jsx index 492e58e5f..de42a56a5 100644 --- a/web/source/settings/components/check-list.jsx +++ b/web/source/settings/components/check-list.jsx @@ -17,8 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -"use strict"; - const React = require("react"); module.exports = function CheckList({ field, header = "All", EntryComponent, getExtraProps }) { diff --git a/web/source/settings/components/combo-box.jsx b/web/source/settings/components/combo-box.jsx index 030bd5c30..fc0133583 100644 --- a/web/source/settings/components/combo-box.jsx +++ b/web/source/settings/components/combo-box.jsx @@ -17,8 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -"use strict"; - const React = require("react"); const { diff --git a/web/source/settings/components/error.jsx b/web/source/settings/components/error.jsx index 283083481..3205cd5e3 100644 --- a/web/source/settings/components/error.jsx +++ b/web/source/settings/components/error.jsx @@ -17,8 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -"use strict"; - const React = require("react"); function ErrorFallback({ error, resetErrorBoundary }) { diff --git a/web/source/settings/components/fake-profile.jsx b/web/source/settings/components/fake-profile.jsx index 04424a5ed..d1f28f36c 100644 --- a/web/source/settings/components/fake-profile.jsx +++ b/web/source/settings/components/fake-profile.jsx @@ -17,8 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -"use strict"; - const React = require("react"); module.exports = function FakeProfile({ avatar, header, display_name, username, role }) { diff --git a/web/source/settings/components/fake-toot.jsx b/web/source/settings/components/fake-toot.jsx index b71831a95..7c2e40454 100644 --- a/web/source/settings/components/fake-toot.jsx +++ b/web/source/settings/components/fake-toot.jsx @@ -17,8 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -"use strict"; - const React = require("react"); const query = require("../lib/query"); diff --git a/web/source/settings/components/form/inputs.jsx b/web/source/settings/components/form/inputs.jsx index 378879525..f7a6beeda 100644 --- a/web/source/settings/components/form/inputs.jsx +++ b/web/source/settings/components/form/inputs.jsx @@ -17,8 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -"use strict"; - const React = require("react"); function TextInput({ label, field, ...inputProps }) { diff --git a/web/source/settings/components/form/mutation-button.jsx b/web/source/settings/components/form/mutation-button.jsx index 5f7218db4..0eaf33912 100644 --- a/web/source/settings/components/form/mutation-button.jsx +++ b/web/source/settings/components/form/mutation-button.jsx @@ -17,8 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -"use strict"; - const React = require("react"); const { Error } = require("../error"); diff --git a/web/source/settings/components/languages.jsx b/web/source/settings/components/languages.jsx index 51006098b..61c76e03a 100644 --- a/web/source/settings/components/languages.jsx +++ b/web/source/settings/components/languages.jsx @@ -17,8 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -"use strict"; - const React = require("react"); const langs = require("langs"); diff --git a/web/source/settings/components/loading.jsx b/web/source/settings/components/loading.jsx index 27ba17499..c62c72a0a 100644 --- a/web/source/settings/components/loading.jsx +++ b/web/source/settings/components/loading.jsx @@ -17,8 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -"use strict"; - const React = require("react"); module.exports = function Loading() { diff --git a/web/source/settings/components/user-logout-card.jsx b/web/source/settings/components/user-logout-card.jsx index 902d545bc..de77f0485 100644 --- a/web/source/settings/components/user-logout-card.jsx +++ b/web/source/settings/components/user-logout-card.jsx @@ -17,8 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -"use strict"; - const React = require("react"); const query = require("../lib/query"); |