mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-11-24 09:45:35 +08:00
fix(config): backend version is likely to be undefined when invoking isUpdateAvailableAPI
This commit is contained in:
parent
79335831cb
commit
398f05d8a5
@ -467,8 +467,12 @@ const Versions: Component<{ backendVersion: Accessor<string> }> = ({
|
||||
}) => {
|
||||
const [isUpdateAvailable, setIsUpdateAvailable] = createSignal(false)
|
||||
|
||||
onMount(async () => {
|
||||
setIsUpdateAvailable(await isUpdateAvailableAPI(backendVersion()))
|
||||
createEffect(async () => {
|
||||
const version = backendVersion()
|
||||
|
||||
if (!version) return
|
||||
|
||||
setIsUpdateAvailable(await isUpdateAvailableAPI(version))
|
||||
})
|
||||
|
||||
return (
|
||||
@ -494,15 +498,14 @@ const Versions: Component<{ backendVersion: Accessor<string> }> = ({
|
||||
}
|
||||
|
||||
export default () => {
|
||||
const [t] = useI18n()
|
||||
|
||||
const [backendVersion, setBackendVersion] = createSignal('')
|
||||
|
||||
onMount(async () => {
|
||||
const version = await fetchBackendVersionAPI()
|
||||
setBackendVersion(version)
|
||||
setBackendVersion(await fetchBackendVersionAPI())
|
||||
})
|
||||
|
||||
const [t] = useI18n()
|
||||
|
||||
return (
|
||||
<div class="mx-auto flex max-w-screen-md flex-col gap-4">
|
||||
<Show when={!isSingBox(backendVersion())}>
|
||||
|
Loading…
Reference in New Issue
Block a user