mirror of
https://github.com/woodchen-ink/nezha-dash-v1.git
synced 2025-07-18 09:31:55 +08:00
commit
0b8af1c4ba
12
src/App.tsx
12
src/App.tsx
@ -1,5 +1,5 @@
|
|||||||
import { useQuery } from "@tanstack/react-query"
|
import { useQuery } from "@tanstack/react-query"
|
||||||
import React, { useCallback } from "react"
|
import React, { useCallback, useEffect } from "react"
|
||||||
import { useTranslation } from "react-i18next"
|
import { useTranslation } from "react-i18next"
|
||||||
import { Route, BrowserRouter as Router, Routes } from "react-router-dom"
|
import { Route, BrowserRouter as Router, Routes } from "react-router-dom"
|
||||||
|
|
||||||
@ -55,6 +55,12 @@ const App: React.FC = () => {
|
|||||||
})
|
})
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (settingData?.data?.custom_code) {
|
||||||
|
InjectContext(settingData?.data?.custom_code)
|
||||||
|
}
|
||||||
|
}, [settingData?.data?.custom_code])
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
return <ErrorPage code={500} message={error.message} />
|
return <ErrorPage code={500} message={error.message} />
|
||||||
}
|
}
|
||||||
@ -67,10 +73,6 @@ const App: React.FC = () => {
|
|||||||
i18n.changeLanguage(settingData?.data?.language)
|
i18n.changeLanguage(settingData?.data?.language)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settingData?.data?.custom_code) {
|
|
||||||
InjectContext(settingData?.data?.custom_code)
|
|
||||||
}
|
|
||||||
|
|
||||||
const customBackgroundImage =
|
const customBackgroundImage =
|
||||||
// @ts-expect-error ShowNetTransfer is a global variable
|
// @ts-expect-error ShowNetTransfer is a global variable
|
||||||
(window.CustomBackgroundImage as string) !== "" ? window.CustomBackgroundImage : undefined
|
(window.CustomBackgroundImage as string) !== "" ? window.CustomBackgroundImage : undefined
|
||||||
|
Loading…
x
Reference in New Issue
Block a user