B
Size: a a a
B
ᛕ
OR
▲
OR
🦜
🦜
🦜
🦜
B
OR
B
ᛕ
ᛕ
ᛕ
▲R
// redirectTo.js
import Router from 'next/router'
export default function redirectTo(
destination,
{ as, res, status } = {},
replace = false
) {
if (res) {
res.writeHead(status || 302, { Location: as || destination })
res.end()
return
} else {
if (destination[0] === '/' && destination[1] !== '/') {
if (replace) {
return Router.replace(destination, as)
} else {
return Router.push(destination, as)
}
} else {
window.location = destination
return
}
}
}
s и
з getInitialProps,
на клиенте нет▲R
ᛕ
🦜