ITADN

Regexp routes redirecting

#31Openivan-suhorukov 创建于 2024-03-05
I
ivan-suhorukovcommented
Now, when i use a RegExp routes, i cannot use `openPage` or `redirectPage` functions. Router throws `RegExp routes are not supported`. So may be we can support this by adding second converter to route? Something like this: ```ts export const $router = createRouter({ profile: [/\/(student|teacher|manager)\/profile/, (urlRole) => { return { role: urlRole }}, (urlRole) => `/${urlRole}/profile`], where it is ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ }) ``` So router can determine the redirect url and do redirect?
5 条评论