2020-04-06 16:46:03 +02:00
|
|
|
function redirect(ctx, path) {
|
2020-04-08 00:47:24 +02:00
|
|
|
if (ctx.res != undefined) {
|
2020-04-06 16:46:03 +02:00
|
|
|
ctx.res.writeHead(302, { Location: path });
|
|
|
|
ctx.res.end();
|
|
|
|
} else {
|
2020-04-08 00:47:24 +02:00
|
|
|
document.location.href = path;
|
2020-04-06 16:46:03 +02:00
|
|
|
}
|
2020-03-23 21:22:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = redirect;
|