apps/web/app/auth/operator/actions.ts
Metadata
- Purpose: Web app route or page component for operator/client experience.
- Domain:
applications - Language:
ts - Bytes: 2836
- Lines: 70
- Content hash (short):
a3c493da - Source (start): apps/web/app/auth/operator/actions.ts:1
- Source (end): apps/web/app/auth/operator/actions.ts:70
Indexed Symbols
sanitizeReturnTo(line 7, function) - Implements sanitize return to for module behavior.buildErrorUrl(line 18, function) - Implements build error url for module behavior.operatorSessionSignInAction(line 30, function) - Implements operator session sign in action for module behavior.operatorSessionSignOutAction(line 62, function) - Implements operator session sign out action for module behavior.
Markdown Headings (if applicable)
No markdown headings detected.
Source Preview
"use server";
import { redirect } from "next/navigation";
import { clearOperatorSessionToken, parseOperatorSessionClaims, setOperatorSessionToken } from "../../../lib/operator-session";
import { isWorkspaceId, withWorkspaceQuery } from "../../../lib/workspace-context";
function sanitizeReturnTo(value: string | null): string {
if (!value || value.trim().length === 0) {
return "/";
}
const trimmed = value.trim();
if (!trimmed.startsWith("/")) {
return "/";
}
return trimmed;
}
function buildErrorUrl(workspaceId: string | null, returnTo: string, message: string): string {
const params = new URLSearchParams();
if (workspaceId) {
params.set("workspaceId", workspaceId);
}
if (returnTo) {
params.set("returnTo", returnTo);
}