mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-05 03:47:12 +00:00
15 lines
328 B
JavaScript
15 lines
328 B
JavaScript
|
|
||
|
export default function ({ route, redirect }) {
|
||
|
const redirectPathRegexp = /^\/redirect(\d+)$/
|
||
|
const match = route.path.match(redirectPathRegexp)
|
||
|
|
||
|
if (match) {
|
||
|
const number = parseInt(match[1])
|
||
|
if (number === 1) {
|
||
|
redirect('/redirect-done')
|
||
|
} else {
|
||
|
redirect(`/redirect${number - 1}`)
|
||
|
}
|
||
|
}
|
||
|
}
|