Skip to content

Commit

Permalink
add subdomain logic for published link
Browse files Browse the repository at this point in the history
  • Loading branch information
RODO94 committed Dec 18, 2024
1 parent 557c9e9 commit e9c3fe0
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@ import Link from "@mui/material/Link";
import Typography from "@mui/material/Typography";
import { useStore } from "pages/FlowEditor/lib/store";
import React from "react";
import { useNavigation } from "react-navi";

import { InnerContainer } from "./SaveResumeButton";

const NavigateToPublishedButton: React.FC = () => {
const navigate = useNavigation();
const [teamSlug, flowSlug] = useStore((state) => [
const [teamSlug, teamDomain, flowSlug] = useStore((state) => [
state.teamSlug,
state.teamDomain,
state.flowSlug,
]);

const subdomainLink = `https://${teamDomain}/${flowSlug}/published`;
const standardLink = `${window.location.origin}/${teamSlug}/${flowSlug}/published`;

const redirectLink = teamDomain ? subdomainLink : standardLink;

const handleClick = () => {
window.open(
`${window.location.origin}/${teamSlug}/${flowSlug}/published`,
"_blank",
);
window.open(redirectLink, "_blank");
};

console.log(window.location.origin);
Expand Down

0 comments on commit e9c3fe0

Please sign in to comment.