merge signup process

This commit is contained in:
rohit-kumar-fullstack
2026-01-13 13:00:16 +05:30
parent eb849681a9
commit 26fc703df9
5 changed files with 150 additions and 172 deletions
+7 -1
View File
@@ -10,6 +10,8 @@ import { useDispatch, useSelector } from 'react-redux';
import { togglePurchaseAuction } from '../../Redux/Slices/selectPurchaseAuction';
import { apiCall } from '../../Axios/Axios';
import { GET_MY_AUCTION } from '../../Services/BBPS/ApiUrls';
import SkeltonList from '../../Component/Skelton/SkeltonList';
import Skeleton from '../../Component/Skelton/Skelton';
const LiveAuction = () => {
const Dispatch = useDispatch()
@@ -136,7 +138,8 @@ const LiveAuction = () => {
</Text>
</Animated.View>
)}
{
isPending ? <Skeleton /> :
<FlatList
data={allBoolean.liveAuctionData ?? []}
renderItem={renderItem}
@@ -166,6 +169,9 @@ const LiveAuction = () => {
windowSize={7}
removeClippedSubviews
/>
}
</View>
);
-19
View File
@@ -65,25 +65,6 @@ const PurchaseAuction = () => {
<SearchInput onChange={() => { }} placeholder='Search....' filterPress={() => { setAllBoolean((prev: any) => ({ ...prev, isShowFilter: !prev.isShowFilter })) }} />
{isPending ? <Skelton />
:
// <FlatList
// data={data.data ||[]}
// keyExtractor={(_, index) => index.toString()}
// showsVerticalScrollIndicator={false}
// contentContainerStyle={{ paddingBottom: 200, paddingHorizontal: 10 }}
// renderItem={({ item, index }) => (
// <PurchaseAuctionTile
// item={item}
// onPressDetails={() => {
// }}
// onStartBidding={() => {
// Dispatch(setAuction(item))
// navigation.navigate(NavigationString.Emd)
// }}
// buttonEnable={isAuctionActive(item)}
// isAuctionEnd={isAuctionEnd(item)}
// />
// )}
// />
<FlatList
data={data.result ?? []}
renderItem={({ item, index }) => (
+20 -14
View File
@@ -36,15 +36,14 @@ const Login = () => {
const [auctionLoading, setAuctionLoading] = useState(false);
const { mutate: loginMutate } = useLogin();
const { mutate: auctionMutate } = useAuctionLogin();
const {data}=useGetDesignation();
const { data } = useGetDesignation();
const { mutate: registrationStateMutate } = useRagistrationState();
const { data: MasterData}=usefetchMasterData()
const { data: MasterData } = usefetchMasterData()
const handleGetData = async () => {
const handleGetData = async () => {
registrationStateMutate(undefined, {
onSuccess: (res: any) => {
console.log('Registration status response try :', res);
if (res?.statusCode === 200) {
const { registrationStatus, contOtherId, contOrganization } = res.data;
@@ -73,7 +72,8 @@ const handleGetData = async () => {
default:
{
console.log("attempting navigation to Ragistration")
Navigation.replace(NavigationString.Registration);}
Navigation.replace(NavigationString.Registration);
}
break;
}
return;
@@ -104,11 +104,12 @@ const handleGetData = async () => {
Navigation.replace('Registration');
},
});
};
};
const HandleLogin = async (values: any) => {
try {
if (activeType === 'tender') {
setLoginLoading(true);
loginMutate(
@@ -116,16 +117,15 @@ const handleGetData = async () => {
{
onSuccess: res => {
if (res.statusCode == 200) {
Dispatch(setToken({ ...res.data, token: res.token }));
Dispatch(setToken({ ...res.data, token: res.token, userType: activeType }));
handleGetData();
} else {
showErrorAlert(res.message)
}
setLoginLoading(false);
},
onError: err => {
showErrorAlert(err.message);
setLoginLoading(false);
},
},
);
@@ -136,7 +136,7 @@ const handleGetData = async () => {
{
onSuccess: res => {
if (res.statusCode == 200) {
Dispatch(setToken({ ...res.data, token: res.token }));
Dispatch(setToken({ ...res.data, token: res.token, userType: activeType }));
Navigation.dispatch(
CommonActions.reset({
index: 0,
@@ -144,15 +144,21 @@ const handleGetData = async () => {
}),
);
}
setAuctionLoading(false);
},
onError: err => {
showErrorAlert(err.message);
setAuctionLoading(false);
setLoginLoading(false);
},
},
);
}
} catch (error) {
} finally {
setAuctionLoading(false);
}
};
const isLoading = activeType === 'tender' ? loginLoading : auctionLoading;
+13 -24
View File
@@ -29,12 +29,11 @@ const Splash: React.FC = () => {
const [isHydrated, setIsHydrated] = useState(false);
const [isLoading, setIsLoading] = useState(true);
// Wait for Redux hydration (works with/without redux-persist)
useEffect(() => {
let unsubscribe: any;
const checkHydration = () => {
const token = (store.getState() as any).token?.token;
if (token !== undefined) { // Defined = hydrated (null/empty/string ok)
if (token !== undefined) {
setIsHydrated(true);
unsubscribe?.();
}
@@ -46,19 +45,7 @@ const Splash: React.FC = () => {
return () => unsubscribe?.();
}, []);
const getToken = useCallback(async (): Promise<string | null> => {
try {
// Redux first (post-hydration), then AsyncStorage fallback
let token = reduxToken;
if (token === undefined) {
token = await AsyncStorage.getItem('token');
}
return token || null;
} catch (error) {
console.error('Token fetch error:', error);
return null;
}
}, [reduxToken]);
const routeByOrgType = (params: { otherId: any; orgType: any }) => {
const orgType = String(params.orgType);
@@ -138,22 +125,25 @@ const Splash: React.FC = () => {
useNativeDriver: true,
}).start();
const token = await getToken();
console.log("Token after hydration -", token, typeof token, !!token);
if (!token) {
console.log('No valid token, navigating to Login');
if (!reduxToken.token) {
navigation.reset({
index: 0,
routes: [{ name: NavigationString.Login || 'Signin' }], // Fallback
routes: [{ name: NavigationString.Login }],
});
return;
}
console.log('Valid token, fetching registration data');
if (reduxToken.userType == 'tender') {
await handleGetData();
} else {
navigation.reset({
index: 0,
routes: [{ name: NavigationString.Home }],
});
}
} catch (error) {
console.error('Splash Error:', error);
navigation.reset({
index: 0,
routes: [{ name: NavigationString.Login || 'Signin' }],
@@ -163,10 +153,9 @@ const Splash: React.FC = () => {
}
};
// Small delay ensures hydration + native animation complete
const timeoutId = setTimeout(runSplash, 200);
return () => clearTimeout(timeoutId);
}, [isFocused, isHydrated, getToken]);
}, [isFocused, isHydrated]);
if (!isHydrated) {
return (
-4
View File
@@ -1,17 +1,14 @@
import { useInfiniteQuery, useMutation, useQuery } from '@tanstack/react-query';
import { contractorStageThreeSubmit, contractorStageTwoSubmit, fetchAuctionItem, fetchCityDropdown, fetchDashboard, fetchEmdCheck, fetchLiveAuction, fetchLiveTender, fetchMasterData, fetchPurchaseAuction, fetchPurchaseAuctionList, fetchPurchaseTender, fetchTenderById, getAuction, getDesignation, getRagistrationState, offlineAuctionPurchase, offlineTenderPurchase, partnerShipSubmit, proceedToBid, registerContractor, sendAadhaarOtp, submitEnvelopeA, submitEnvelopeB, uploadEnvelopeFile, userAuctionLogin, userLogin, verifyAadhaarOtp, verifyGstNumber, verifyPanHandler, viewAuctionDocumentDownload, viewAuctionDocuments, viewAuctionItemDocuments, fetchPurchaseAuctionPage } from './apis';
import { apiCall } from '../../Axios/Axios';
// User
export const useLogin = () => {
console.log("hitting here")
return useMutation({
mutationFn: (payload: { emailAdd: string, password: string }) => userLogin(payload),
});
};
export const useAuctionLogin = () => {
console.log("hitting here")
return useMutation({
mutationFn: (payload: { emailAdd: string, password: string }) => userAuctionLogin(payload),
});
@@ -194,7 +191,6 @@ export const useRagistrationState = () => {
});
};
//////////////////////////////////////////////////////
export const usefetchMasterData = () => {
return useQuery({