Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

509 B
Raw Blame
import { useRouterState } from "@tanstack/react-router";

/** Where shared links point: the app's alias (`APP_ALIAS_URL`) when set, since every public page works there too. */
export function useShareOrigin() {
	const aliasUrl = useRouterState({
		select: (state): string | undefined => state.matches.at(-1)?.context.flags?.aliasUrl,
	});
	// Build-time marketing renders have neither route matches nor a deployment origin.
	return aliasUrl ?? (typeof window === "undefined" ? "" : window.location.origin);
}