Skip to content

Commit

Permalink
EPMGCIP-171: Add new constants file "routes.ts", declare basic consta…
Browse files Browse the repository at this point in the history
…nts, update usages
  • Loading branch information
Dzmitry-Yaniuk committed Nov 23, 2024
1 parent 6cb0da7 commit 406b068
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/components/organisms/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ import styles from "./Header.module.scss";
import LanguageSwitcher from "@/components/molecules/LanguageSwitcher/LanguageSwitcher";
import logo from "@/assets/image/logo.png";
import { useRouter } from "@/navigation";
import { baseUrl } from "@/constants/routes";

export default function Header() {
const router = useRouter();
const locale = useLocale();
const t = useTranslations();

const onClickLogo = (): void => {
router.push("/");
router.push(baseUrl);
};

return (
Expand Down
3 changes: 2 additions & 1 deletion src/components/pages/Home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { useRouter } from "@/navigation";
import ImageGallery from "@/components/organisms/ImageGallery/ImageGallery";

import styles from "./Home.module.scss";
import { exhibitUrl } from "@/constants/routes";

interface Props {
exhibits: ITopLatestExhibit[];
Expand Down Expand Up @@ -45,7 +46,7 @@ export default function Home(props: Props): React.ReactElement {
return;
}

router.push(`exhibit/${exhibit.slug}`);
router.push(`${exhibitUrl}/${exhibit.slug}`);
};

return (
Expand Down
3 changes: 3 additions & 0 deletions src/constants/routes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const baseUrl = "/";

export const exhibitUrl = `/exhibit`;

0 comments on commit 406b068

Please sign in to comment.