I have nuxt app. I want to create path like this:
path: '/dworzec-pkp/:slug/:category?/:date?',
So there would be two optional params. Example urls would be:
localhost:5555/dworzec-pkp/nowa-iwiczna<-- w/o optional paramslocalhost:5555/dworzec-pkp/nowa-iwiczna/12-10-2020<-- optional param: datelocalhost:5555/dworzec-pkp/nowa-iwiczna/departures<-- optional param: categorylocalhost:5555/dworzec-pkp/nowa-iwiczna/departures/12-10-2020<-- optional params: date & category
How do I know if url contain category or date? Should I create just directories dworzec-pkp/_slug and within it _.vue file, and then programmatically decide whether it is date or category? Or maybe there's some better solution for that?
Currently I tried like this:
and my issue is that when i enter this localhost:5555/dworzec-pkp/nowa-iwiczna/12-10-2020 then it is treated as :category?. Also I would need to basically almost copy-paste entire _date.vue and index.vue there as this pages are almost same.
