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

10 lines
216 B
JavaScript
Raw Normal View History

function redirect(ctx, path) {
if (ctx.res) {
ctx.res.writeHead(302, { Location: path });
ctx.res.end();
} else {
document.location.pathname = path;
}
}
module.exports = redirect;