mirror of
https://github.com/logto-io/logto.git
synced 2025-02-03 21:48:55 -05:00
refactor(experience): reorg hooks location (#4877)
reorg hooks location
This commit is contained in:
parent
34494e96f7
commit
2c1cf66c6b
12 changed files with 25 additions and 30 deletions
|
@ -7,12 +7,12 @@ import Button from '@/components/Button';
|
|||
import Divider from '@/components/Divider';
|
||||
import DynamicT from '@/components/DynamicT';
|
||||
import { useSieMethods } from '@/hooks/use-sie';
|
||||
import useBindSocialRelatedUser from '@/hooks/use-social-link-related-user';
|
||||
import useSocialRegister from '@/hooks/use-social-register';
|
||||
import type { SocialRelatedUserInfo } from '@/types/guard';
|
||||
import { maskEmail, maskPhone } from '@/utils/format';
|
||||
|
||||
import * as styles from './index.module.scss';
|
||||
import useBindSocialRelatedUser from './use-social-link-related-user';
|
||||
|
||||
type Props = {
|
||||
className?: string;
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import { useCallback } from 'react';
|
||||
|
||||
import { bindSocialRelatedUser } from '@/apis/interaction';
|
||||
|
||||
import useApi from './use-api';
|
||||
import useErrorHandler from './use-error-handler';
|
||||
import usePreSignInErrorHandler from './use-pre-sign-in-error-handler';
|
||||
import useApi from '@/hooks/use-api';
|
||||
import useErrorHandler from '@/hooks/use-error-handler';
|
||||
import usePreSignInErrorHandler from '@/hooks/use-pre-sign-in-error-handler';
|
||||
|
||||
const useBindSocialRelatedUser = () => {
|
||||
const handleError = useErrorHandler();
|
|
@ -3,10 +3,10 @@ import classNames from 'classnames';
|
|||
|
||||
import SocialLinkButton from '@/components/Button/SocialLinkButton';
|
||||
import useNativeMessageListener from '@/hooks/use-native-message-listener';
|
||||
import useSocial from '@/hooks/use-social';
|
||||
import { getLogoUrl } from '@/utils/logo';
|
||||
|
||||
import * as styles from './index.module.scss';
|
||||
import useSocial from './use-social';
|
||||
|
||||
type Props = {
|
||||
className?: string;
|
||||
|
|
|
@ -3,12 +3,11 @@ import { useCallback, useContext } from 'react';
|
|||
|
||||
import PageContext from '@/Providers/PageContextProvider/PageContext';
|
||||
import { getSocialAuthorizationUrl } from '@/apis/interaction';
|
||||
import useApi from '@/hooks/use-api';
|
||||
import useErrorHandler from '@/hooks/use-error-handler';
|
||||
import { getLogtoNativeSdk, isNativeWebview } from '@/utils/native-sdk';
|
||||
import { generateState, storeState, buildSocialLandingUri } from '@/utils/social-connectors';
|
||||
|
||||
import useApi from './use-api';
|
||||
import useErrorHandler from './use-error-handler';
|
||||
|
||||
const useSocial = () => {
|
||||
const { experienceSettings, theme } = useContext(PageContext);
|
||||
|
|
@ -3,9 +3,9 @@ import { useParams } from 'react-router-dom';
|
|||
|
||||
import StaticPageLayout from '@/Layout/StaticPageLayout';
|
||||
import SocialLanding from '@/containers/SocialLanding';
|
||||
import useSocialCallbackHandler from '@/hooks/use-social-callback-handler';
|
||||
|
||||
import * as styles from './index.module.scss';
|
||||
import useSocialCallbackHandler from './use-social-callback-handler';
|
||||
|
||||
type Parameters = {
|
||||
connectorId: string;
|
||||
|
|
|
@ -3,9 +3,9 @@ import { useParams } from 'react-router-dom';
|
|||
|
||||
import StaticPageLayout from '@/Layout/StaticPageLayout';
|
||||
import SocialLandingContainer from '@/containers/SocialLanding';
|
||||
import useSocialLandingHandler from '@/hooks/use-social-landing-handler';
|
||||
|
||||
import * as styles from './index.module.scss';
|
||||
import useSocialLandingHandler from './use-social-landing-handler';
|
||||
|
||||
type Parameters = {
|
||||
connectorId: string;
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
import { useState, useCallback } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import useToast from '@/hooks/use-toast';
|
||||
import { SearchParameters } from '@/types';
|
||||
import { getSearchParameters } from '@/utils';
|
||||
import { storeCallbackLink } from '@/utils/social-connectors';
|
||||
|
||||
import useToast from './use-toast';
|
||||
|
||||
const useSocialLandingHandler = () => {
|
||||
const [loading, setLoading] = useState(true);
|
||||
const { setToast } = useToast();
|
|
@ -1,7 +1,7 @@
|
|||
import useSingleSignOnListener from '@/hooks/use-single-sign-on-listener';
|
||||
|
||||
import SignIn from '../SignIn';
|
||||
|
||||
import useSingleSignOnListener from './use-single-sign-on-listener';
|
||||
|
||||
/**
|
||||
* Single sign-on callback page
|
||||
*/
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import useSocialSignInListener from '@/hooks/use-social-sign-in-listener';
|
||||
|
||||
import SignIn from '../SignIn';
|
||||
|
||||
import useSocialSignInListener from './use-social-sign-in-listener';
|
||||
|
||||
/**
|
||||
* Social sign in callback page
|
||||
*/
|
||||
|
|
|
@ -3,13 +3,12 @@ import { useTranslation } from 'react-i18next';
|
|||
import { useSearchParams } from 'react-router-dom';
|
||||
|
||||
import { singleSignOnAuthorization } from '@/apis/single-sign-on';
|
||||
import useApi from '@/hooks/use-api';
|
||||
import useErrorHandler from '@/hooks/use-error-handler';
|
||||
import useToast from '@/hooks/use-toast';
|
||||
import { parseQueryParameters } from '@/utils';
|
||||
import { stateValidation } from '@/utils/social-connectors';
|
||||
|
||||
import useApi from './use-api';
|
||||
import useErrorHandler from './use-error-handler';
|
||||
import useToast from './use-toast';
|
||||
|
||||
/**
|
||||
* Single Sign On authentication callback handler.
|
||||
*
|
|
@ -6,19 +6,18 @@ 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 usePreSignInErrorHandler from '@/hooks/use-pre-sign-in-error-handler';
|
||||
import { useSieMethods } from '@/hooks/use-sie';
|
||||
import useSocialRegister from '@/hooks/use-social-register';
|
||||
import useTerms from '@/hooks/use-terms';
|
||||
import useToast from '@/hooks/use-toast';
|
||||
import { socialAccountNotExistErrorDataGuard } from '@/types/guard';
|
||||
import { parseQueryParameters } from '@/utils';
|
||||
import { stateValidation } from '@/utils/social-connectors';
|
||||
|
||||
import useApi from './use-api';
|
||||
import useErrorHandler from './use-error-handler';
|
||||
import type { ErrorHandlers } from './use-error-handler';
|
||||
import usePreSignInErrorHandler from './use-pre-sign-in-error-handler';
|
||||
import { useSieMethods } from './use-sie';
|
||||
import useSocialRegister from './use-social-register';
|
||||
import useTerms from './use-terms';
|
||||
import useToast from './use-toast';
|
||||
|
||||
const useSocialSignInListener = (connectorId: string) => {
|
||||
const { setToast } = useToast();
|
||||
const { signInMode } = useSieMethods();
|
Loading…
Add table
Reference in a new issue