fix back-button on /pro
This commit is contained in:
parent
7c7ddcf0d5
commit
eb0ad25c3c
@ -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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user