mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-11-10 05:15: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)
|
const [isUpdateAvailable, setIsUpdateAvailable] = createSignal(false)
|
||||||
|
|
||||||
onMount(async () => {
|
createEffect(async () => {
|
||||||
setIsUpdateAvailable(await isUpdateAvailableAPI(backendVersion()))
|
const version = backendVersion()
|
||||||
|
|
||||||
|
if (!version) return
|
||||||
|
|
||||||
|
setIsUpdateAvailable(await isUpdateAvailableAPI(version))
|
||||||
})
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -494,15 +498,14 @@ const Versions: Component<{ backendVersion: Accessor<string> }> = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
|
const [t] = useI18n()
|
||||||
|
|
||||||
const [backendVersion, setBackendVersion] = createSignal('')
|
const [backendVersion, setBackendVersion] = createSignal('')
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
const version = await fetchBackendVersionAPI()
|
setBackendVersion(await fetchBackendVersionAPI())
|
||||||
setBackendVersion(version)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const [t] = useI18n()
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class="mx-auto flex max-w-screen-md flex-col gap-4">
|
<div class="mx-auto flex max-w-screen-md flex-col gap-4">
|
||||||
<Show when={!isSingBox(backendVersion())}>
|
<Show when={!isSingBox(backendVersion())}>
|
||||||
|
Loading…
Reference in New Issue
Block a user