mirror of
https://github.com/logto-io/logto.git
synced 2024-12-23 20:33:16 -05:00
Merge pull request #986 from logto-io/charles-fix-sign-in-failure
fix: revert "refactor(console): handle user navigates to 'callback' after authenticated"
This commit is contained in:
commit
fb49b4e100
1 changed files with 2 additions and 14 deletions
|
@ -1,24 +1,12 @@
|
||||||
import { LogtoError, OidcError, useHandleSignInCallback } from '@logto/react';
|
import { LogtoError, OidcError, useHandleSignInCallback } from '@logto/react';
|
||||||
import React, { useEffect } from 'react';
|
import React from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
|
||||||
|
|
||||||
import AppError from '@/components/AppError';
|
import AppError from '@/components/AppError';
|
||||||
import LogtoLoading from '@/components/LogtoLoading';
|
import LogtoLoading from '@/components/LogtoLoading';
|
||||||
import { getBasename } from '@/utilities/app';
|
import { getBasename } from '@/utilities/app';
|
||||||
|
|
||||||
const Callback = () => {
|
const Callback = () => {
|
||||||
const { error, isAuthenticated } = useHandleSignInCallback(getBasename());
|
const { error } = 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]);
|
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
const errorCode =
|
const errorCode =
|
||||||
|
|
Loading…
Reference in a new issue