feat: app Portal IT + /m/portal redirige al tablero IT
This commit is contained in:
1 parent
39cb4ec89a
commit
70df8e95a9
2 files changed
+9
-1
No files matched your search
@@ -214,6 +214,8 @@ export function getStatusInfo(m: ModuleState) {
|
||||
}
|
||||
|
||||
export function displayName(name: string) {
|
||||
const key = name.toLowerCase();
|
||||
if (key === "portal") return "Portal IT";
|
||||
return name.charAt(0).toUpperCase() + name.slice(1).replace(/-/g, " ");
|
||||
}
|
||||
|
||||
|
||||
+7
-1
@@ -1,7 +1,10 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import type { NextRequest } from "next/server";
|
||||
|
||||
const IT_BOARD = "https://it.sam.devops.norteamericano.cl/tablero";
|
||||
|
||||
// it.sam.devops... muestra el tablero IT manteniendo la URL.
|
||||
// /m/portal ya no existe: redirige al tablero IT (Portal IT).
|
||||
export function middleware(req: NextRequest) {
|
||||
const host = (req.headers.get("host") || "").toLowerCase();
|
||||
if (host.startsWith("it.sam.") && req.nextUrl.pathname === "/") {
|
||||
@@ -9,9 +12,12 @@ export function middleware(req: NextRequest) {
|
||||
url.pathname = "/tablero";
|
||||
return NextResponse.rewrite(url);
|
||||
}
|
||||
if (req.nextUrl.pathname === "/m/portal" || req.nextUrl.pathname.startsWith("/m/portal/")) {
|
||||
return NextResponse.redirect(IT_BOARD);
|
||||
}
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: ["/"],
|
||||
matcher: ["/", "/m/portal/:path*"],
|
||||
};
|
||||
Reference in new issue
Block a user