1
0
Fork 0
mackenzii/projects/frontend/src/utilities/vuetils.ts

16 lines
477 B
TypeScript

import { useRoute } from 'vue-router'
import { deepCopy } from './dom'
/**
* Gets the current route from useRoute
* after performing some additional checks
* to ensure consistency across the site.
* @returns a slightly modified {@link useRoute} route
*/
export const getCurrentRoute = () => {
const route = deepCopy(useRoute())
if (route.path !== '/' && route.path.endsWith('/')) {
route.path = route.path.substring(0, route.path.length - 1)
}
return route
}