refactor code

This commit is contained in:
Abhinav 2023-04-14 11:00:47 +05:30
parent 0216d394b9
commit f2329fede9
2 changed files with 4 additions and 12 deletions

View file

@ -27,7 +27,7 @@ export const ALLOWED_APP_PAGES = new Map([
], ],
]); ]);
const getAppNameAndTitle = () => { export const getAppNameAndTitle = () => {
if (!runningInBrowser()) { if (!runningInBrowser()) {
return {}; return {};
} }

View file

@ -67,12 +67,7 @@ import { AppProps } from 'next/app';
import DialogBoxV2 from 'components/DialogBoxV2'; import DialogBoxV2 from 'components/DialogBoxV2';
import { getTheme } from 'themes'; import { getTheme } from 'themes';
import { PAGES } from 'constants/pages'; import { PAGES } from 'constants/pages';
import { import { ALLOWED_APP_PAGES, APPS, getAppNameAndTitle } from 'constants/apps';
ALLOWED_APP_PAGES,
APPS,
getAppName,
getAppTitle,
} from 'constants/apps';
const redirectMap = new Map([ const redirectMap = new Map([
['roadmap', getRoadmapRedirectURL], ['roadmap', getRoadmapRedirectURL],
@ -165,10 +160,8 @@ export default function App(props) {
THEME_COLOR.DARK THEME_COLOR.DARK
); );
const [appName, appTitle] = useMemo(() => { const { name: appName, title: appTitle } = useMemo(() => {
const appName = getAppName(); return getAppNameAndTitle();
const appTitle = getAppTitle();
return [appName, appTitle];
}, []); }, []);
useEffect(() => { useEffect(() => {
@ -285,7 +278,6 @@ export default function App(props) {
setLoading(true); setLoading(true);
} }
const appName = getAppName();
if ( if (
appName === APPS.ALBUMS && appName === APPS.ALBUMS &&
ALLOWED_APP_PAGES.get(APPS.ALBUMS).indexOf(newPathname) === -1 ALLOWED_APP_PAGES.get(APPS.ALBUMS).indexOf(newPathname) === -1