Skip to content

Commit

Permalink
Merge pull request #391 from Game-as-a-Service/fix/unexpected-token-f…
Browse files Browse the repository at this point in the history
…rom-query-string

fix: use useSearchParams for token retrieval instead use useRouter
  • Loading branch information
JohnsonMao authored Jul 14, 2024
2 parents fc1ff77 + ad56691 commit a35a9b6
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions pages/auth/token/[token].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@ import { ReactElement, useEffect } from "react";
import { useRouter } from "next/router";
import { GetStaticProps, GetStaticPaths } from "next";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";

import { NextPageWithProps } from "@/pages/_app";
import useUser from "@/hooks/useUser";

const Token: NextPageWithProps = () => {
const {
query: { token },
push,
} = useRouter();
const { login } = useUser();
const { push, asPath } = useRouter();
const regex = /^\/auth\/token\/(.+)$/;
const token = asPath.match(regex)?.[1];

const { login } = useUser();
useEffect(() => {
if (token) {
login(token as string);
Expand Down

0 comments on commit a35a9b6

Please sign in to comment.