Skip to content

Commit

Permalink
navigate properly
Browse files Browse the repository at this point in the history
  • Loading branch information
harryob committed Oct 15, 2024
1 parent 6523ce5 commit 1764d38
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/userLookup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { LinkColor } from "./link";
import { Expand } from "./expand";
import { StickybanMatch } from "./stickybanMatch";
import { callApi } from "../helpers/api";
import { useLoaderData } from "react-router-dom";
import { useLoaderData, useNavigate } from "react-router-dom";
import { NameExpand } from "./nameExpand";

type ActiveLookupType = {
Expand Down Expand Up @@ -90,14 +90,16 @@ export const LookupMenu: React.FC<LookupMenuProps> = (
}
}, [value, userData, discordId, updateUser, potentialUser, user]);

const nav = useNavigate();

return (
<ActiveLookupContext.Provider value={{ updateUser: updateUser }}>
{!value && !discordId && (
<form
className="flex flex-row justify-center gap-3"
onSubmit={(event) => {
event.preventDefault();
updateUser({ userCkey: user });
nav(`/user/${user}`);
}}
>
<label htmlFor="ckey">User: </label>
Expand Down

0 comments on commit 1764d38

Please sign in to comment.