diff --git a/src/app/(withAuth)/courses/page.tsx b/src/app/(withAuth)/courses/page.tsx index eb1bb1d7..7b8711e9 100644 --- a/src/app/(withAuth)/courses/page.tsx +++ b/src/app/(withAuth)/courses/page.tsx @@ -9,6 +9,7 @@ const CoursePage: NextPage = async () => {
UserID: {session.getUserId()}

Courses

+
); }; diff --git a/src/components/organisms/Providers.tsx b/src/components/organisms/Providers.tsx index ec3cc2f4..d7781ffd 100644 --- a/src/components/organisms/Providers.tsx +++ b/src/components/organisms/Providers.tsx @@ -7,7 +7,7 @@ import { usePathname, useRouter } from 'next/navigation'; import React from 'react'; import { SuperTokensWrapper } from 'supertokens-auth-react'; -import { ensureSuperTokensReactInit, setRouter } from '../../infrastructures/supertokens/frontend'; +import { ensureSuperTokensReactInit, setRouter } from '../../infrastructures/supertokens/frontendConfig'; import { theme } from '../../theme'; ensureSuperTokensReactInit(); diff --git a/src/components/organisms/SignOutMenuItem.tsx b/src/components/organisms/SignOutMenuItem.tsx index f1c384f1..522cfe9c 100644 --- a/src/components/organisms/SignOutMenuItem.tsx +++ b/src/components/organisms/SignOutMenuItem.tsx @@ -13,6 +13,7 @@ export const SignOutMenuItem: React.FC = () => { onClick={async () => { await signOut(); router.push('/'); + router.refresh(); }} > サインアウト diff --git a/src/infrastructures/supertokens/frontend.ts b/src/infrastructures/supertokens/frontendConfig.ts similarity index 85% rename from src/infrastructures/supertokens/frontend.ts rename to src/infrastructures/supertokens/frontendConfig.ts index 181a8be4..f9c6f054 100644 --- a/src/infrastructures/supertokens/frontend.ts +++ b/src/infrastructures/supertokens/frontendConfig.ts @@ -5,6 +5,7 @@ import EmailPasswordReact from 'supertokens-auth-react/recipe/emailpassword'; import SessionReact from 'supertokens-auth-react/recipe/session'; import { appInfo } from './appInfo'; +import { router } from 'next/client'; const routerInfo: { router?: ReturnType; pathName?: string } = {}; @@ -16,7 +17,14 @@ export function setRouter(router: ReturnType, pathName: string export const frontendConfig = (): SuperTokensConfig => { return { appInfo, - recipeList: [EmailPasswordReact.init(), SessionReact.init()], + recipeList: [ + EmailPasswordReact.init({ + onHandleEvent: async (context) => { + router.referesh(); + }, + }), + SessionReact.init(), + ], windowHandler: (original) => ({ ...original, location: {