0

I would like to get the last parts of an url in order to know in which "case" I am : edit, add, delete or list. Moreover, I would like to know what is the page where I am.

Here some examples :

xxxxx/xxxx/items/add

Page: items
case: add

xxxxx/xxxx/items/edit/:id

Page : items
case: edit
id: xxxx

xxxxx/xxxx/items

Page : items
case: list

For now, I can determine if I'm edit or add case by using includes function. I can also get the last part of my url but, only the last part. So if i'm on edit case, I only get the id.

Thank you very much for any advices/solutions !

Joe Allen
  • 1,267
  • 4
  • 24
  • 41

0 Answers0