How to do this for a catchall route? #2
-
First of all this package is the most useful thing I've found in some time. Well I'm trying to also use it for a route that looks something like this join: defineRoute("/join/[...workspace]", {
params: z.object({
"...workspace": z.array(z.string()),
}),
}), problem is when trying to access it in RSC it throws an error saying
this is the import { routes } from "~/lib/navigation";
export default async function JoinWorkspacePage({
params,
}: {
params: {
workspace: unknown;
};
}) {
const {
"...workspace": [workspace, invitation],
} = routes.join.$parseParams(params.workspace);
return (
<div>
<h1>
{workspace} via {invitation}
</h1>
<form>
<button type="submit">Join</button>
</form>
</div>
);
} |
Beta Was this translation helpful? Give feedback.
Answered by
statusunknown418
Feb 3, 2024
Replies: 1 comment
-
UPDATE: found a fix, just to not declare the catchall route as |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
statusunknown418
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
UPDATE: found a fix, just to not declare the catchall route as
[...route]
but[route]
and the keep the same logic to$parseParams
makes it work ok