@@ -6,7 +6,7 @@ import * as https from 'https' import { NextPage } from 'next' import type { AppProps } from 'next/app' import { Raleway } from 'next/font/google' -import { getSession,SessionProvider } from 'next-auth/react' +import { getSession, SessionProvider, signOut } from 'next-auth/react' import { appWithTranslation } from 'next-i18next' import { NextStep, NextStepProvider } from 'nextstepjs' import { FlagProvider } from '@unleash/proxy-client-react' @@ -38,8 +38,8 @@ axios.interceptors.response.use(async (response) => { const session = await getSession() - if (!session) { - window.location.href = '/login' + if (!session || session.error) { + await signOut({ callbackUrl: '/login' }) } return response