diff --git a/packages/web/components/templates/homeFeed/AddLinkModal.tsx b/packages/web/components/templates/homeFeed/AddLinkModal.tsx index ea8fb1cbe..282033cd6 100644 --- a/packages/web/components/templates/homeFeed/AddLinkModal.tsx +++ b/packages/web/components/templates/homeFeed/AddLinkModal.tsx @@ -6,8 +6,11 @@ import { Button } from '../../elements/Button' import { FormInput } from '../../elements/FormElements' import { Box, VStack } from '../../elements/LayoutPrimitives' import { - ModalButtonBar, ModalContent, - ModalOverlay, ModalRoot, ModalTitleBar + ModalButtonBar, + ModalContent, + ModalOverlay, + ModalRoot, + ModalTitleBar, } from '../../elements/ModalPrimitives' type AddLinkModalProps = { @@ -20,7 +23,7 @@ export function AddLinkModal(props: AddLinkModalProps): JSX.Element { const handleLinkSubmission = useCallback( async (link: string) => { const result = await saveUrlMutation(link) - if (result && result.url) { + if (result) { toast( () => ( @@ -30,7 +33,9 @@ export function AddLinkModal(props: AddLinkModalProps): JSX.Element { style="ctaDarkYellow" autoFocus onClick={() => { - window.location.href = `/article?url=${encodeURIComponent(result.url || link)}` + window.location.href = `/article?url=${encodeURIComponent( + link + )}` }} > Read Now diff --git a/packages/web/pages/api/save.ts b/packages/web/pages/api/save.ts index 5d4e36439..a43e6ccb7 100644 --- a/packages/web/pages/api/save.ts +++ b/packages/web/pages/api/save.ts @@ -51,7 +51,7 @@ export default async ( const saveResult = await saveUrl(req, url) console.log('saveResult: ', saveResult) if (saveResult?.url) { - res.redirect(`?url=${encodeURIComponent(saveResult?.url)}`) + res.redirect(`?url=${encodeURIComponent(url.toString())}`) return }