Open AlexandreRoba opened 1 month ago
Sorry for the late response. I just checked an I came up with the same solution.
pub enum App {
#[target(index)]
Index,
Directors(Directors)
}
pub enum Directors {
director_id: String,
#[target(nested)]
target: DirectorRoute,
};
pub enum DirectorRoute {
#[target(index)]
Index,
}
The idea was that the value takes the first (local) segment. And thus would result in an empty value.
An alternative could be:
pub enum App {
#[target(index)]
Index,
Directors
#[target(rename="directors"]
DirectorsWith{ id: String }
}
Hi all, I'm trying to find a way to map routes that looks like this: -/directors/ map to director list
-/directors/xxxxx map to the director details
I came up with something like this:
But no matter what I do, I always have "details" in the path -/directors/ map to director list
-/directors/details/xxxxx map to the director details
What would be the best way to acheive this? I found a way using something like this:
But then I need to pattern math with a gard where I check if the director_id is empty then display the list and if not display the details....
Is this the way? :p