1
0
Fork 0

feat(lab): Add support for multiple versions in the lab

This commit is contained in:
Joost De Cock 2022-03-26 18:06:02 +01:00
parent 4db8ab099b
commit d4833fb6a4
14 changed files with 280 additions and 48 deletions

View file

@ -0,0 +1,16 @@
import { useRouter } from 'next/router'
export const defaultVersion = 'next'
const useVersion = () => {
const { pathname } = useRouter()
const chunks = pathname.split('/')
const version = (chunks[1] === 'v')
? chunks[2]
: defaultVersion
return version
}
export default useVersion