From ba70fc30be2dce2d48904336d8ef3a25a2ac836c Mon Sep 17 00:00:00 2001 From: Eamon Ma Date: Fri, 22 Jul 2022 00:47:36 -0400 Subject: [PATCH] Hotfix: revert sharePrefix to hook --- components/ShareLink.tsx | 4 ++-- components/ShareModal.tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/ShareLink.tsx b/components/ShareLink.tsx index d843658..f75050b 100644 --- a/components/ShareLink.tsx +++ b/components/ShareLink.tsx @@ -18,7 +18,7 @@ import { useTranslation } from "next-i18next" import { useEffect, useState } from "react" import useSWR from "swr" import fetcher from "../src/utils/fetcher" -import getSharePrefix from "../src/utils/getSharePrefix" +import useSharePrefix from "../src/useSharePrefix" const useShortLink = (url: string) => { const { data, error } = useSWR(`/api/shorten?url=${url}`, fetcher) @@ -35,7 +35,7 @@ const ShareLink = () => { const id = router.query.id - const sharePrefix = getSharePrefix() + const [sharePrefix] = useSharePrefix() const fullUrl = `${sharePrefix}${id}` const [urlToShare, setUrlToShare] = useState(fullUrl) diff --git a/components/ShareModal.tsx b/components/ShareModal.tsx index 499138c..f3ad975 100644 --- a/components/ShareModal.tsx +++ b/components/ShareModal.tsx @@ -25,7 +25,7 @@ import { DUPLICATE_TIMETABLE } from "../operations/mutations/duplicateTimetable" import { ExternalLinkIcon } from "@chakra-ui/icons" import { useTranslation } from "next-i18next" import ShareLink from "./ShareLink" -import getSharePrefix from "../src/utils/getSharePrefix" +import useSharePrefix from "../src/useSharePrefix" type Props = { isOpen: boolean @@ -37,7 +37,7 @@ const ShareModal = ({ isOpen, onClose }: Props) => { const id = router.query.id - const sharePrefix = getSharePrefix() + const [sharePrefix] = useSharePrefix() const [duplicateTimetable] = useMutation(DUPLICATE_TIMETABLE)