/**
 * Extracts the "returnPath" parameter from the current URL's query string and returns it.
 * If the parameter is not present, returns the provided fallback path.
 *
 * @param {string} fallbackPath - The fallback path to use if "returnPath" is not found in the query string.
 * @return {string} The "returnPath" from the query string, or the fallback path if "returnPath" is not present.
 */
export function returnPathOr(fallbackPath: string): string {
  const urlParams = new URLSearchParams(window.location.search);
  const returnPath = urlParams.get("returnPath");

  return returnPath ?? fallbackPath;
}
