the latest code
This commit is contained in:
1 parent
d28bc1ed43
commit
9bbb24a52b
12226 files changed
+1455579
-21
No files matched your search
+1
@@ -0,0 +1 @@
|
||||
export declare function resolvePageComponent<T>(path: string | string[], pages: Record<string, Promise<T> | (() => Promise<T>)>): Promise<T>;
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
export async function resolvePageComponent(path, pages) {
|
||||
for (const p of (Array.isArray(path) ? path : [path])) {
|
||||
const page = pages[p];
|
||||
if (typeof page === 'undefined') {
|
||||
continue;
|
||||
}
|
||||
return typeof page === 'function' ? page() : page;
|
||||
}
|
||||
throw new Error(`Page not found: ${path}`);
|
||||
}
|
||||
Reference in new issue
Block a user