Skip to content

Commit 9487e95

Browse files
committed
Add placeholder for subroutes and endpoints
1 parent eb32baa commit 9487e95

4 files changed

Lines changed: 23 additions & 0 deletions

File tree

codegen/layouts/partials/route-class-endpoint.hbs

Whitespace-only changes.

codegen/layouts/partials/route-class-subroute.hbs

Whitespace-only changes.

codegen/layouts/route.hbs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,12 @@
22

33
class {{className}} {
44
{{> route-class-methods }}
5+
6+
{{#each subroutes}}
7+
{{> route-class-subroute }}
8+
{{/each}}
9+
10+
{{#each endpoints}}
11+
{{> route-class-endpoint }}
12+
{{/each}}
513
}

codegen/lib/connect.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,22 @@ export const connect = (
3939

4040
interface RouteLayoutContext {
4141
className: string
42+
endpoints: EndpointLayoutContext[]
43+
subroutes: SubrouteLayoutContext[]
4244
isClientSessionRoute: boolean
4345
isActionAttemptsRoute: boolean
4446
needsActionAttempts: boolean
4547
}
4648

49+
interface EndpointLayoutContext {
50+
routeName: string
51+
}
52+
53+
interface SubrouteLayoutContext {
54+
methodName: string
55+
className: string
56+
}
57+
4758
const setRootRouteLayoutContext = (
4859
file: Partial<RouteLayoutContext>,
4960
_blueprint: Blueprint,
@@ -52,6 +63,8 @@ const setRootRouteLayoutContext = (
5263
file.needsActionAttempts = false
5364
file.isClientSessionRoute = false
5465
file.isActionAttemptsRoute = false
66+
file.endpoints = []
67+
file.subroutes = []
5568
}
5669

5770
const setRouteLayoutContext = (
@@ -63,4 +76,6 @@ const setRouteLayoutContext = (
6376
file.needsActionAttempts = false
6477
file.isClientSessionRoute = route.name === '/client_sessions'
6578
file.isActionAttemptsRoute = route.name === '/action_attempts'
79+
file.endpoints = []
80+
file.subroutes = []
6681
}

0 commit comments

Comments
 (0)