diff --git a/pages/auth/token/[token].tsx b/pages/auth/token/[token].tsx index 35c770a7..75531572 100644 --- a/pages/auth/token/[token].tsx +++ b/pages/auth/token/[token].tsx @@ -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);