Skip to content

Commit 9703aca

Browse files
committed
formatting
1 parent 681646f commit 9703aca

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/inertia-helpers/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
export async function resolvePageComponent<T>(path: string, pages: Record<string, T | (() => Promise<T>)>) {
1+
export async function resolvePageComponent<T>(path: string, pages: Record<string, Promise<T> | (() => Promise<T>)>): Promise<T> {
22
const page = pages[path]
3+
34
if (typeof page === 'undefined') {
45
throw new Error(`Page not found: ${path}`)
56
}
67

7-
return typeof page === 'function' ? await (page as () => Promise<T>)() : page
8+
return typeof page === 'function' ? page() : page
89
}

0 commit comments

Comments
 (0)