Skip to content

Commit

Permalink
feat: add params handling for new PR (#2062)
Browse files Browse the repository at this point in the history
Co-authored-by: Nick Taylor <[email protected]>
Co-authored-by: OGBONNA SUNDAY <[email protected]>
  • Loading branch information
3 people authored Nov 15, 2023
1 parent f449798 commit b878429
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions components/molecules/HighlightInput/highlight-input-form.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useRouter } from "next/router";
import { useEffect, useRef, useState } from "react";

import { FiCalendar, FiEdit2 } from "react-icons/fi";
Expand Down Expand Up @@ -113,6 +114,12 @@ const HighlightInputForm = ({ refreshCallback }: HighlightInputFormProps): JSX.E
const popoverContentRef = useRef<HTMLDivElement>(null);
const generateSummary = useRef(false);

const router = useRouter();
const { prurl } = router.query;
useEffect(() => {
if (prurl) setHighlightLink(prurl as string);
}, [prurl]);

const fetchAllUserHighlights = async (page: number): Promise<DbHighlight[]> => {
const req = await fetch(
`${process.env.NEXT_PUBLIC_API_URL}/users/${loggedInUser?.user_metadata.user_name}/highlights?page=${page}`,
Expand Down Expand Up @@ -619,6 +626,7 @@ const HighlightInputForm = ({ refreshCallback }: HighlightInputFormProps): JSX.E
</button>
</Tooltip>
<TextInput
id="highlight-link-input"
className="text-sm shadow-none h-10 flex-none"
value={highlightLink}
handleChange={(value) => setHighlightLink(value)}
Expand Down
2 changes: 1 addition & 1 deletion pages/feed/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const Feeds: WithPageLayout<HighlightSSRProps> = (props: HighlightSSRProps) => {
const signInRequired = queryParams.get("signIn");

if (newHighlight && signInRequired) {
signIn({ provider: "github", options: { redirectTo: `${window.location.origin}/feed?new=${newHighlight}` } });
signIn({ provider: "github", options: { redirectTo: `${window.location.origin}/feed?${queryParams}` } });
}

// no need to create intervals for checking the highlight creation input if there is no new highlight
Expand Down

0 comments on commit b878429

Please sign in to comment.