mirror of
https://github.com/whyour/qinglong.git
synced 2026-09-22 19:29:13 +08:00
接口提示信息国际化
This commit is contained in:
@@ -134,6 +134,23 @@ export default function () {
|
||||
getHealthStatus();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
request
|
||||
.get(`${config.apiPrefix}system/config`)
|
||||
.then(({ data }: any) => {
|
||||
if (!data?.info?.lang) {
|
||||
const browserLang =
|
||||
localStorage.getItem('lang') ||
|
||||
navigator.language?.slice(0, 2) ||
|
||||
'zh';
|
||||
request
|
||||
.put(`${config.apiPrefix}system/config/lang`, { lang: browserLang })
|
||||
.catch(() => {});
|
||||
}
|
||||
})
|
||||
.catch(() => {});
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (theme === 'vs-dark') {
|
||||
document.body.setAttribute('data-dark', 'true');
|
||||
|
||||
Reference in New Issue
Block a user