mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
17 lines
378 B
TypeScript
17 lines
378 B
TypeScript
// next imports
|
|
import Router from "next/router";
|
|
|
|
const redirect = (context: any, target: any) => {
|
|
if (context.res) {
|
|
// server
|
|
// 303: "See other"
|
|
context.res.writeHead(301, { Location: target });
|
|
context.res.end();
|
|
} else {
|
|
// In the browser, we just pretend like this never even happened ;)
|
|
Router.push(target);
|
|
}
|
|
};
|
|
|
|
export default redirect;
|