fix overridenav
This commit is contained in:
parent
a1ab7bc734
commit
0f5660cbec
|
|
@ -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;
|
||||||
|
}) => {};
|
||||||
|
|
@ -1,14 +1,7 @@
|
||||||
/// <reference types="bun-types" />
|
/// <reference types="bun-types" />
|
||||||
|
|
||||||
type ServerArg = {
|
import { ServerArg } from "./server-route";
|
||||||
req: Request;
|
|
||||||
handle: (req: Request) => Promise<Response>;
|
|
||||||
mode: "dev" | "prod";
|
|
||||||
url: {
|
|
||||||
raw: URL;
|
|
||||||
pathname: string;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
type ServerSession = {
|
type ServerSession = {
|
||||||
handle: (arg: ServerArg) => Promise<Response>;
|
handle: (arg: ServerArg) => Promise<Response>;
|
||||||
};
|
};
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { overrideNav } from "./override-nav";
|
||||||
|
|
||||||
const w = window as any;
|
const w = window as any;
|
||||||
if (typeof isEditor === "undefined") {
|
if (typeof isEditor === "undefined") {
|
||||||
|
|
@ -12,3 +13,5 @@ if (typeof isEditor === "undefined") {
|
||||||
}
|
}
|
||||||
w.isMobile = false;
|
w.isMobile = false;
|
||||||
w.isDesktop = false;
|
w.isDesktop = false;
|
||||||
|
|
||||||
|
overrideNav();
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import { getPathname } from "lib/utils/pathname";
|
||||||
const w = window as any;
|
const w = window as any;
|
||||||
|
|
||||||
export const overrideNav = (arg?: { local?: 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.prasi_menu = { nav_override: true, nav: w.navigate, pm: null };
|
||||||
w.navigate = (async (_href, params) => {
|
w.navigate = (async (_href, params) => {
|
||||||
if (!_href) {
|
if (!_href) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue