diff --git a/package.json b/package.json index 06a13bc6..0d0a1d2a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vocechat-web", - "version": "0.3.34", + "version": "0.3.35", "private": true, "homepage": "https://voce.chat", "dependencies": { diff --git a/src/routes/setting/Overview/FrontendURL.tsx b/src/routes/setting/Overview/FrontendURL.tsx index cd269d98..f2e1b046 100644 --- a/src/routes/setting/Overview/FrontendURL.tsx +++ b/src/routes/setting/Overview/FrontendURL.tsx @@ -1,14 +1,14 @@ // import React from 'react' import { useTranslation } from 'react-i18next'; -import { useUpdateFrontendUrlMutation } from '../../../app/services/server'; +import { useGetFrontendUrlQuery, useUpdateFrontendUrlMutation } from '../../../app/services/server'; import StyledInput from "../../../common/component/styled/Input"; import StyledButton from "../../../common/component/styled/Button"; import { ChangeEvent, useState, useEffect } from 'react'; import { toast } from 'react-hot-toast'; -import ServerVersionChecker from '../../../common/component/ServerVersionChecker'; // type Props = {} const Index = () => { + const { data, isSuccess: getUrlSuccess } = useGetFrontendUrlQuery(); const [url, setUrl] = useState(location.origin); const { t } = useTranslation("setting"); const { t: ct } = useTranslation(); @@ -25,7 +25,12 @@ const Index = () => { toast.success("Update Successfully!"); } }, [isSuccess]); - + useEffect(() => { + if (getUrlSuccess && data) { + setUrl(data); + } + }, [getUrlSuccess, data]); + // if(!fetch) return (

{t("overview.url.title")}

@@ -35,10 +40,9 @@ const Index = () => {

- - - {ct("action.update")} - + + + {ct("action.update")}
); diff --git a/src/routes/setting/Overview/index.tsx b/src/routes/setting/Overview/index.tsx index 345bf05f..e51c31c4 100644 --- a/src/routes/setting/Overview/index.tsx +++ b/src/routes/setting/Overview/index.tsx @@ -8,6 +8,7 @@ import useConfig from "../../../common/hook/useConfig"; import Server from './server'; import Language from './Language'; import FrontendURL from "./FrontendURL"; +import ServerVersionChecker from "../../../common/component/ServerVersionChecker"; const StyledWrapper = styled.div` position: relative; @@ -88,14 +89,9 @@ export default function Overview() { const guest = v === "true"; updateLoginConfig({ ...loginConfig, guest }); }; - - - if (!loginConfig) return null; - const { who_can_sign_up: whoCanSignUp, guest = false } = loginConfig as LoginConfig; const isAdmin = loginUser?.is_admin; - return ( @@ -125,16 +121,15 @@ export default function Overview() { values={["true", "false"]} value={String(guest)} onChange={(v) => { - console.log("wtff", v); - handleGuestToggle(v); }} /> - + + + )} - );