Problem/Motivation
Similar to v3 graphql, route() could return an interface Route
Then we have 3 types
- RouteInternal
- RouteExternal
- RouteRedirect
Each one of those is super useful for implementation by a frontend developer.
Example might be:
Frontend dev has a wildcard router.
User clicks link.
Router fetches '/test'/
Test returns from Drupal as an internal redirect
Frontend can get what it needs to redirect the user via transition rather than window.location.
Proposed resolution
Unsure where to put this code.
It doesnt feel like it follows the core principal of this module.
Its a sub module or side project at best. I'll create the issue here anyway for discussion.
Remaining tasks
Decide where and if this lives here.
If its all-round usefulness is core, then how this integrates with DataManager is unknown.
User interface changes
None
API changes
Addition of route()
Data model changes
Adds 'route' field to Link
interface Route {
url: String!
internal: Boolean!
}
type RouteInternal implements Route {
url: String!
internal: Boolean!
entity: RouteUnion
}
type RouteExternal implements Route {
url: String!
internal: Boolean!
}
type RouteRedirect implements Route {
url: String!
internal: Boolean!
status: Int!
redirect: Boolean!
}