fix back-button on /pro

This commit is contained in:
vchikalkin 2025-09-18 15:12:58 +03:00
parent 7c7ddcf0d5
commit eb0ad25c3c

View File

@ -4,6 +4,8 @@ import { backButton } from '@telegram-apps/sdk-react';
import { usePathname, useRouter } from 'next/navigation';
import { useCallback, useEffect } from 'react';
const exclude = ['/pro'];
export function useBackButton() {
const { back } = useRouter();
const pathname = usePathname();
@ -31,6 +33,8 @@ export function useBackButton() {
}, [pathname]);
}
function isRootLevelPage(path: string) {
return path.split('/').filter(Boolean).length === 1;
function isRootLevelPage(pathname: string) {
if (exclude.includes(pathname)) return true;
return pathname.split('/').filter(Boolean).length === 1;
}