@@ -2,8 +2,6 @@ import { FormInput, messageInstance, PasswordInput } from "lowcoder-design";
22import {
33 AuthBottomView ,
44 ConfirmButton ,
5- FormWrapperMobile ,
6- LoginCardTitle ,
75 StyledRouteLink ,
86} from "pages/userAuth/authComponents" ;
97import React , { useContext , useEffect , useState } from "react" ;
@@ -15,7 +13,7 @@ import { UserConnectionSource } from "@lowcoder-ee/constants/userConstants";
1513import { trans } from "i18n" ;
1614import { AuthContext , useAuthSubmit } from "pages/userAuth/authUtils" ;
1715import { ThirdPartyAuth } from "pages/userAuth/thirdParty/thirdPartyAuth" ;
18- import { AUTH_FORGOT_PASSWORD_URL , AUTH_REGISTER_URL , ORG_AUTH_FORGOT_PASSWORD_URL , ORG_AUTH_REGISTER_URL } from "constants/routesURL" ;
16+ import { AUTH_FORGOT_PASSWORD_URL , AUTH_REGISTER_URL } from "constants/routesURL" ;
1917import { Link , useLocation , useParams } from "react-router-dom" ;
2018import { Divider } from "antd" ;
2119import Flex from "antd/es/flex" ;
@@ -27,7 +25,6 @@ import LeftOutlined from "@ant-design/icons/LeftOutlined";
2725import { fetchConfigAction } from "@lowcoder-ee/redux/reduxActions/configActions" ;
2826import { useDispatch , useSelector } from "react-redux" ;
2927import history from "util/history" ;
30- import ApplicationApi from "@lowcoder-ee/api/applicationApi" ;
3128import { getServerSettings } from "@lowcoder-ee/redux/selectors/applicationSelector" ;
3229import { fetchOrgPaginationByEmail } from "@lowcoder-ee/util/pagination/axios" ;
3330import PaginationComp from "@lowcoder-ee/util/pagination/Pagination" ;
@@ -120,9 +117,10 @@ export default function FormLoginSteps(props: FormLoginProps) {
120117 const serverSettings = useSelector ( getServerSettings ) ;
121118 const [ elements , setElements ] = useState < ElementsState > ( { elements : [ ] , total : 0 } ) ;
122119 const [ currentPage , setCurrentPage ] = useState ( 1 ) ;
123- const [ pageSize , setPageSize ] = useState ( 2 ) ;
120+ const [ pageSize , setPageSize ] = useState ( 10 ) ;
124121
125122 useEffect ( ( ) => {
123+ if ( account )
126124 fetchOrgPaginationByEmail ( {
127125 email : account ,
128126 pageNum : currentPage ,
@@ -169,20 +167,25 @@ export default function FormLoginSteps(props: FormLoginProps) {
169167 }
170168
171169 setOrgLoading ( true ) ;
172- OrgApi . fetchOrgsByEmail ( account )
170+ fetchOrgPaginationByEmail ( {
171+ email : account ,
172+ pageNum : currentPage ,
173+ pageSize : pageSize
174+ } )
173175 . then ( ( resp ) => {
174- if ( validateResponse ( resp ) ) {
175- setOrgList ( resp . data . data ) ;
176- if ( ! resp . data . data . length ) {
176+ if ( resp . success ) {
177+ setElements ( { elements : resp . data || [ ] , total : resp . total || 1 } )
178+ setOrgList ( resp . data ) ;
179+ if ( ! resp . data . length ) {
177180 history . push (
178181 AUTH_REGISTER_URL ,
179182 { ...location . state || { } , email : account } ,
180183 )
181184 return ;
182185 }
183- if ( resp . data . data . length === 1 ) {
184- setOrganizationId ( resp . data . data [ 0 ] . orgId ) ;
185- dispatch ( fetchConfigAction ( resp . data . data [ 0 ] . orgId ) ) ;
186+ if ( resp . data . length === 1 ) {
187+ setOrganizationId ( resp . data [ 0 ] . orgId ) ;
188+ dispatch ( fetchConfigAction ( resp . data [ 0 ] . orgId ) ) ;
186189 setCurrentStep ( CurrentStepEnum . AUTH_PROVIDERS ) ;
187190 return ;
188191 }
0 commit comments