export async function redirectTemplate(action_name: string): Promise { return `import type { Context } from "koa"; import { Mountable } from "@sealcode/sealgen"; import type Router from "@koa/router"; export const actionName = "${action_name}"; export default new (class ${action_name}Redirect extends Mountable { // eslint-disable-next-line @typescript-eslint/no-unused-vars async canAccess(_: Context) { return { canAccess: true, message: "" }; } mount(router: Router, path: string) { router.get(path, async (ctx) => { ctx.status = 302; ctx.redirect("/new_url"); }); } })(); `; }