Here i am having a path like this and getting it from useLocation hook:
function usePageViews() {
let location = useLocation()
React.useEffect(
() => {
GApageView(location.pathname)
},
[location]
)
}
let path1 = /account/forgotPassword/eyJhbGciOiJIUzUxMiJ9.ir1AeAKLZexUzGhjJvBuzm9jkqZahLAbRwTmOAjB8ZMpj3QLtkpymFwATNb_rP4fu0YgbRT4H9jetszOOSLEsg/ab/en/
in this above value , i need to get only the path route Eg:
Result:
/account/forgotPassword
in someScenarios , the paths will be like this
let path1 = /account/login
let path2 = /
For this i need to get the value as it is.
Is there anyway i can achieve this.Please help me with this. Thanks in advance