fix(Plugins NavMenu): Getting the Plugins navigation menu to correctly match i18n

This commit is contained in:
haitaoo
2023-02-22 11:42:03 +08:00
parent 57843bc0ce
commit 26c9ff6998
+8 -3
View File
@@ -9,6 +9,7 @@ import { usePageTags } from '@/hooks';
import { AccordionNav } from '@/components';
import { ADMIN_NAV_MENUS } from '@/common/constants';
import { useQueryPlugins } from '@/services';
import { interfaceStore } from '@/stores';
import './index.scss';
@@ -27,14 +28,12 @@ const formPaths = [
const Index: FC = () => {
const { t } = useTranslation('translation', { keyPrefix: 'page_title' });
const { pathname } = useLocation();
const interfaceLang = interfaceStore((_) => _.interface.language);
const { data: configurablePlugins, mutate: updateConfigurablePlugins } =
useQueryPlugins({
status: 'active',
have_config: true,
});
usePageTags({
title: t('admin'),
});
const menus = cloneDeep(ADMIN_NAV_MENUS);
if (configurablePlugins && configurablePlugins.length > 0) {
@@ -62,7 +61,13 @@ const Index: FC = () => {
window.removeEventListener('message', observePlugins);
};
}, []);
useEffect(() => {
updateConfigurablePlugins();
}, [interfaceLang]);
usePageTags({
title: t('admin'),
});
return (
<>
<div className="bg-light py-2">