From 858468037c7e4db896b10cba228efe279f4c9c26 Mon Sep 17 00:00:00 2001 From: Charles Zhao Date: Mon, 30 May 2022 12:03:07 +0800 Subject: [PATCH] fix: revert "refactor(console): handle user navigates to 'callback' after authenticated" This reverts commit 540812d0605e31247d6bd07a7727449842a28f98. --- packages/console/src/pages/Callback/index.tsx | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/packages/console/src/pages/Callback/index.tsx b/packages/console/src/pages/Callback/index.tsx index efd548f30..d13670e0f 100644 --- a/packages/console/src/pages/Callback/index.tsx +++ b/packages/console/src/pages/Callback/index.tsx @@ -1,24 +1,12 @@ import { LogtoError, OidcError, useHandleSignInCallback } from '@logto/react'; -import React, { useEffect } from 'react'; -import { useNavigate } from 'react-router-dom'; +import React from 'react'; import AppError from '@/components/AppError'; import LogtoLoading from '@/components/LogtoLoading'; import { getBasename } from '@/utilities/app'; const Callback = () => { - const { error, isAuthenticated } = useHandleSignInCallback(getBasename()); - const navigate = useNavigate(); - - /** - * Redirect back to the home page if the user is already authenticated. - * Corner case when user mistakenly navigate to `/callback` route after a successful authentication. - */ - useEffect(() => { - if (isAuthenticated) { - navigate('/'); - } - }, [isAuthenticated, navigate]); + const { error } = useHandleSignInCallback(getBasename()); if (error) { const errorCode =