Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
@@ -16,6 +16,15 @@ export function sessionTenantDashboardPath(tenant: { slug?: string | null } | nu
|
||||
return tenant?.slug ? appPath({ tenantSlug: tenant.slug, path: "dashboard", mode: "host-aware" }) : "/";
|
||||
}
|
||||
|
||||
function preserveRedirectToast(target: string, request: Request): string {
|
||||
const messageKey = new URL(request.url).searchParams.get("toast");
|
||||
if (!messageKey) return target;
|
||||
|
||||
const url = new URL(target, request.url);
|
||||
url.searchParams.set("toast", messageKey);
|
||||
return target.startsWith("/") ? `${url.pathname}${url.search}${url.hash}` : url.toString();
|
||||
}
|
||||
|
||||
export const loader = withMetrics("app-root", async ({ request }: LoaderFunctionArgs) => {
|
||||
const userInfo = await getUserInfo(request);
|
||||
const user = await getUser(userInfo.userId);
|
||||
@@ -28,13 +37,13 @@ export const loader = withMetrics("app-root", async ({ request }: LoaderFunction
|
||||
// Redirect auf denselben Host und pingpongt mit der /dashboard-Route zurueck auf / -> Endlosschleife.
|
||||
// In dem Fall in den normalen Tenant-Flow fallen (Profil-/Tenant-Auswahl statt Admin-Dashboard).
|
||||
if (user.admin && routing.adminAppHost && routing.adminAppHost !== routing.webAppHost) {
|
||||
throw redirect(absoluteAdminPath(routing, "dashboard"));
|
||||
throw redirect(preserveRedirectToast(absoluteAdminPath(routing, "dashboard"), request));
|
||||
}
|
||||
const myTenants = await getMyTenants(userInfo.userId);
|
||||
if (myTenants.length === 1) {
|
||||
throw redirect(sessionTenantDashboardPath(myTenants[0]));
|
||||
throw redirect(preserveRedirectToast(sessionTenantDashboardPath(myTenants[0]), request));
|
||||
}
|
||||
throw redirect("/select-tenant");
|
||||
throw redirect(preserveRedirectToast("/select-tenant", request));
|
||||
});
|
||||
|
||||
// Der Loader leitet immer weiter; diese Komponente rendert nie (Fallback fuer die Route-Konvention).
|
||||
|
||||
Reference in new issue
Block a user