Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,18 @@
|
||||
import type { Params } from "react-router";
|
||||
import { adminPath } from "~/utils/app/CanonicalUrlUtils";
|
||||
import UrlUtils from "~/utils/app/UrlUtils";
|
||||
|
||||
const replaceTokens = (href: string, tokens: string[], value: string) => tokens.reduce((next, token) => next.split(token).join(value), href);
|
||||
|
||||
const getAppOrAdminBasePath = (params: Params) => {
|
||||
const basePath = params.tenant ? UrlUtils.currentTenantUrl(params) : adminPath(undefined, { mode: "host-aware" });
|
||||
return UrlUtils.stripTrailingSlash(basePath);
|
||||
};
|
||||
|
||||
export function resolveOnboardingHref(href: string, params: Params, userId?: string) {
|
||||
let resolved = href;
|
||||
resolved = replaceTokens(resolved, [":tenant", "{tenant}", "$tenant"], params.tenant ?? "");
|
||||
resolved = replaceTokens(resolved, [":user", "{user}", "$user"], userId ?? "");
|
||||
resolved = replaceTokens(resolved, [":appOrAdmin", "{appOrAdmin}", "$appOrAdmin"], getAppOrAdminBasePath(params));
|
||||
return resolved;
|
||||
}
|
||||
Reference in new issue
Block a user