Futa Arai 2 лет назад
Родитель
Сommit
ad24748a8e

+ 1 - 1
apps/app/src/components/Me/OtherSettings.tsx

@@ -7,8 +7,8 @@ import { UncontrolledTooltip } from 'reactstrap';
 
 import { apiv3Put } from '~/client/util/apiv3-client';
 import { toastSuccess, toastError } from '~/client/util/toastr';
+import { useSWRxIsQuestionnaireEnabled } from '~/features/questionnaire/client/stores/questionnaire';
 import { useCurrentUser } from '~/stores/context';
-import { useSWRxIsQuestionnaireEnabled } from '~/stores/questionnaire';
 
 const OtherSettings = (): JSX.Element => {
   const { t } = useTranslation();

+ 5 - 2
apps/app/src/components/Me/PersonalSettings.jsx

@@ -53,7 +53,6 @@ const PersonalSettings = () => {
         Icon: () => <i className="icon-fw icon-settings"></i>,
         Content: OtherSettings,
         i18n: t('Other Settings'),
-        index: 6,
       },
     };
   }, [t]);
@@ -61,7 +60,11 @@ const PersonalSettings = () => {
   const getDefaultTabIndex = () => {
     // e.g) '/me#password_settings' sets password settings tab as default
     const tab = window.location.hash?.substring(1);
-    return navTabMapping[tab]?.index;
+    let defaultTabIndex;
+    Object.keys(navTabMapping).forEach((key, i) => {
+      if (key === tab) { defaultTabIndex = i }
+    });
+    return defaultTabIndex;
   };
 
   return (