Skip to content

Commit

Permalink
fix(experience): fix the terms of use not clickable bug (#5670)
Browse files Browse the repository at this point in the history
* fix(experience): fix the terms of use not clickable bug

fix the terms of use not clickable bug

* chore: remove changeset

remove changeset
  • Loading branch information
simeng-li authored Apr 10, 2024
1 parent 5131cf7 commit e1d4df4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ const SingleSignOn = ({ connectorId }: Props) => {
*/
useNativeMessageListener(socialConnectors.length > 0);

useSingleSignOnListener(connectorId);
const { loading } = useSingleSignOnListener(connectorId);

return <LoadingLayer />;
return loading ? <LoadingLayer /> : null;
};

export default SingleSignOn;
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ type Props = {
};

const SocialSignIn = ({ connectorId }: Props) => {
useSocialSignInListener(connectorId);
const { loading } = useSocialSignInListener(connectorId);

return <LoadingLayer />;
return loading ? <LoadingLayer /> : null;
};

export default SocialSignIn;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SignInMode } from '@logto/schemas';
import { useState, useCallback, useEffect } from 'react';
import { useCallback, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useSearchParams } from 'react-router-dom';

Expand Down Expand Up @@ -52,6 +52,7 @@ const useSingleSignOnRegister = () => {
const useSingleSignOnListener = (connectorId: string) => {
const { t } = useTranslation();

const [loading, setLoading] = useState(true);
const [isConsumed, setIsConsumed] = useState(false);
const [searchParameters, setSearchParameters] = useSearchParams();
const { setToast } = useToast();
Expand All @@ -71,6 +72,7 @@ const useSingleSignOnListener = (connectorId: string) => {
});

if (error) {
setLoading(false);
await handleError(error, {
'user.identity_not_exist': async (error) => {
// Should not let user register new social account under sign-in only mode
Expand Down Expand Up @@ -128,6 +130,8 @@ const useSingleSignOnListener = (connectorId: string) => {
singleSignOnHandler,
t,
]);

return { loading };
};

export default useSingleSignOnListener;
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import type { RequestErrorBody } from '@logto/schemas';
import { SignInMode } from '@logto/schemas';
import { useEffect, useCallback, useMemo, useState } from 'react';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useNavigate, useSearchParams } from 'react-router-dom';
import { validate } from 'superstruct';

import { signInWithSocial } from '@/apis/interaction';
import useApi from '@/hooks/use-api';
import useErrorHandler from '@/hooks/use-error-handler';
import type { ErrorHandlers } from '@/hooks/use-error-handler';
import useErrorHandler from '@/hooks/use-error-handler';
import usePreSignInErrorHandler from '@/hooks/use-pre-sign-in-error-handler';
import { useSieMethods } from '@/hooks/use-sie';
import useSocialRegister from '@/hooks/use-social-register';
Expand All @@ -19,6 +19,7 @@ import { parseQueryParameters } from '@/utils';
import { stateValidation } from '@/utils/social-connectors';

const useSocialSignInListener = (connectorId: string) => {
const [loading, setLoading] = useState(true);
const { setToast } = useToast();
const { signInMode } = useSieMethods();
const { t } = useTranslation();
Expand Down Expand Up @@ -90,6 +91,7 @@ const useSocialSignInListener = (connectorId: string) => {
});

if (error) {
setLoading(false);
await handleError(error, signInWithSocialErrorHandlers);

return;
Expand Down Expand Up @@ -130,6 +132,8 @@ const useSocialSignInListener = (connectorId: string) => {
signInWithSocialHandler,
t,
]);

return { loading };
};

export default useSocialSignInListener;

0 comments on commit e1d4df4

Please sign in to comment.