Added Warehouse sessionStore

This commit is contained in:
Srinath 2026-03-05 19:10:38 +05:30
parent 47b35ddd59
commit 289e4744d3
1 changed files with 12 additions and 11 deletions

View File

@ -92,7 +92,6 @@ const BranchLogin = () => {
setAftergetPin(true); setAftergetPin(true);
} }
}, []); }, []);
useEffect(() => { useEffect(() => {
if (aftergetPin == true && UserType == 'Super Admin User') { if (aftergetPin == true && UserType == 'Super Admin User') {
fetchData(seletedBranchData); fetchData(seletedBranchData);
@ -117,7 +116,7 @@ const BranchLogin = () => {
}; };
}, [seconds, disabled]); }, [seconds, disabled]);
const fetchData = async (e) => { const fetchData = async (e, type) => {
await sessionStore('BranchId', e); await sessionStore('BranchId', e);
let data = { let data = {
CompId: CompId, CompId: CompId,
@ -135,7 +134,7 @@ const BranchLogin = () => {
(item) => item.SettingIdName === filterSettingIdName (item) => item.SettingIdName === filterSettingIdName
); );
if (res?.data?.statusCode == 1) { if (res?.data?.statusCode == 1 && type !== 'W') {
filteredDatas?.[0]?.SettingValue == 'Y' filteredDatas?.[0]?.SettingValue == 'Y'
? navigate(`${subDirectory}app-page/home`) ? navigate(`${subDirectory}app-page/home`)
: navigate(`${subDirectory}sales`); : navigate(`${subDirectory}sales`);
@ -192,8 +191,12 @@ const BranchLogin = () => {
const onChangeBranch = async (e) => { const onChangeBranch = async (e) => {
let data = CompBranchData?.find((a) => a?.BrId == e); let data = CompBranchData?.find((a) => a?.BrId == e);
if (data?.LocationType == 'W') await dispatch(changeWarehouse(true)); if (data?.LocationType == 'W') {
sessionStore("Warehouse", true)
await dispatch(changeWarehouse(true));
}
else { else {
sessionStore("Warehouse", false)
await dispatch(changeWarehouse(false)); await dispatch(changeWarehouse(false));
} }
@ -204,7 +207,7 @@ const BranchLogin = () => {
dispatch(changeOrderCardDetails([])); dispatch(changeOrderCardDetails([]));
if (UserType != 'Super Admin User') { if (UserType != 'Super Admin User') {
await fetchData(e); await fetchData(e, data?.LocationType);
} else { } else {
const checkData = SAdminUserData?.filter( const checkData = SAdminUserData?.filter(
(item) => (item) =>
@ -562,14 +565,12 @@ const BranchLogin = () => {
{SelectTypeName === 'OTP' {SelectTypeName === 'OTP'
? !FirstTimeOtp ? !FirstTimeOtp
? `send ${SelectTypeName.toLocaleLowerCase()}` ? `send ${SelectTypeName.toLocaleLowerCase()}`
: `resend ${SelectTypeName.toLocaleLowerCase()}${ : `resend ${SelectTypeName.toLocaleLowerCase()}${seconds > 0 ? ` in ${seconds}s` : ''
seconds > 0 ? ` in ${seconds}s` : '' }`
}`
: !FirstTimePin : !FirstTimePin
? `send ${SelectTypeName.toLocaleLowerCase()}` ? `send ${SelectTypeName.toLocaleLowerCase()}`
: `resend ${SelectTypeName.toLocaleLowerCase()}${ : `resend ${SelectTypeName.toLocaleLowerCase()}${seconds > 0 ? ` in ${seconds}s` : ''
seconds > 0 ? ` in ${seconds}s` : '' }`}
}`}
</button> </button>
</div> </div>
</div> </div>