From d82f0d77442781a89cd418d2a36d4483362bdb5b Mon Sep 17 00:00:00 2001 From: "Kalle (Sendou)" <38327916+Sendouc@users.noreply.github.com> Date: Mon, 20 Dec 2021 11:21:33 +0200 Subject: [PATCH] Account for search queries when returning to page --- app/components/Layout/UserItem.tsx | 2 +- app/utils/index.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/components/Layout/UserItem.tsx b/app/components/Layout/UserItem.tsx index 5c26ebeb5..23a5e83b3 100644 --- a/app/components/Layout/UserItem.tsx +++ b/app/components/Layout/UserItem.tsx @@ -1,4 +1,4 @@ -import { useLocation } from "react-router"; +import { useLocation } from "remix"; import { getLogInUrl } from "~/utils"; import { useUser } from "~/utils/hooks"; import { DiscordIcon } from "../icons/Discord"; diff --git a/app/utils/index.ts b/app/utils/index.ts index bc5c0dbaf..592f026da 100644 --- a/app/utils/index.ts +++ b/app/utils/index.ts @@ -26,7 +26,9 @@ export function getUser(ctx: any) { /** Get link to log in with query param set as current page */ export function getLogInUrl(location: ReturnType) { - return `/auth/discord?origin=${encodeURIComponent(location.pathname)}`; + return `/auth/discord?origin=${encodeURIComponent( + location.pathname + location.search + )}`; } /** Get fields from `request.formData()`. Throw an error if the formData doesn't contain a requested field. */