fix overridenav

This commit is contained in:
rizky 2024-08-21 02:22:09 -07:00
parent a1ab7bc734
commit 0f5660cbec
5 changed files with 19 additions and 10 deletions

13
server/server-route.ts Executable file
View File

@ -0,0 +1,13 @@
export type ServerArg = {
req: Request;
handle: (req: Request) => Promise<Response>;
mode: "dev" | "prod";
url: {
raw: URL;
pathname: string;
};
};
export const newRoute = (arg: {
url: string;
handler: (arg: ServerArg) => Promise<Response | void> | Response | void;
}) => {};

View File

@ -1,14 +1,7 @@
/// <reference types="bun-types" />
type ServerArg = {
req: Request;
handle: (req: Request) => Promise<Response>;
mode: "dev" | "prod";
url: {
raw: URL;
pathname: string;
};
};
import { ServerArg } from "./server-route";
type ServerSession = {
handle: (arg: ServerArg) => Promise<Response>;
};

View File

@ -1,3 +1,4 @@
import { overrideNav } from "./override-nav";
const w = window as any;
if (typeof isEditor === "undefined") {
@ -12,3 +13,5 @@ if (typeof isEditor === "undefined") {
}
w.isMobile = false;
w.isDesktop = false;
overrideNav();

View File

@ -5,7 +5,7 @@ import { getPathname } from "lib/utils/pathname";
const w = window as any;
export const overrideNav = (arg?: { local?: any }) => {
if (!w.prasi_menu && !isEditor) {
if ((!w.prasi_menu && !isEditor) || arg?.local) {
w.prasi_menu = { nav_override: true, nav: w.navigate, pm: null };
w.navigate = (async (_href, params) => {
if (!_href) {