use preact matcher internal api call
This commit is contained in:
parent
5d9390bb34
commit
d2563c1647
@ -247,8 +247,23 @@ function Redirect({ to }: { to: string }): null {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function shouldShowPendingOperations(path: string): boolean {
|
function matchesRoute(url: string, route: string): boolean {
|
||||||
// FIXME: replace includes with a match API like preact router does
|
type MatcherFunc = (
|
||||||
// [Pages.balanceHistory, Pages.dev, Pages.settings, Pages.backup]
|
url: string,
|
||||||
return ["/balance/history/", "/dev", "/settings", "/backup"].includes(path);
|
route: string,
|
||||||
|
opts: any,
|
||||||
|
) => Record<string, string> | false;
|
||||||
|
|
||||||
|
const internalPreactMatcher: MatcherFunc = (Router as any).exec;
|
||||||
|
const result = internalPreactMatcher(url, route, {});
|
||||||
|
return !result ? false : true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function shouldShowPendingOperations(url: string): boolean {
|
||||||
|
return [
|
||||||
|
Pages.balanceHistory.pattern,
|
||||||
|
Pages.dev,
|
||||||
|
Pages.settings,
|
||||||
|
Pages.backup,
|
||||||
|
].some((p) => matchesRoute(url, p));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user