flagon-io/g1t

public

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

g1t/apps/sudo/app/routes/legacy-accounts.tsx

22 lines794 bytesCodeBlame
1import { data, redirect } from "react-router";
2
3import type { Route } from "./+types/legacy-accounts";
4import { requireStaff } from "~/lib/staff";
5import { legacyAccountPath } from "~/lib/workspaces";
6
7/**
8 * Old links: `/accounts` was the list, `/accounts/ws_<slug>` a workspace's
9 * own account and `/accounts/ent_…` an enterprise.
10 */
11export async function loader({ request, params, context }: Route.LoaderArgs) {
12 requireStaff(context);
13 const id = (params["*"] ?? "").replace(/\/+$/, "");
14 if (!id) return redirect(`/workspaces${new URL(request.url).search}`, 301);
15 const path = legacyAccountPath(id);
16 if (!path) throw data("That is not a workspace or an enterprise.", { status: 404 });
17 return redirect(path, 301);
18}
19
20export default function LegacyAccounts() {
21 return null;
22}