2020-08-03 12:04:07 +02:00
|
|
|
function redirect (ctx, path) {
|
|
|
|
if (ctx.res != null) {
|
|
|
|
ctx.res.writeHead(302, { Location: path })
|
|
|
|
ctx.res.end()
|
|
|
|
} else {
|
|
|
|
document.location.href = path
|
|
|
|
}
|
2020-03-23 21:22:41 +01:00
|
|
|
}
|
|
|
|
|
2020-08-03 12:04:07 +02:00
|
|
|
module.exports = redirect
|