This repository has been archived on 2024-10-29. You can view files and clone it, but cannot push or open issues or pull requests.
FunctionProject/website/utils/redirect.js

11 lines
200 B
JavaScript
Raw Normal View History

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-08-03 12:04:07 +02:00
module.exports = redirect