Skip to content

Commit

Permalink
PWA-3233 : Unable to sign-In using TAB/ Mouse Click button from Sign
Browse files Browse the repository at this point in the history
  • Loading branch information
glo82145 committed Mar 21, 2024
2 parents fb7d5aa + 4108b61 commit d7ae8d6
Showing 1 changed file with 10 additions and 19 deletions.
29 changes: 10 additions & 19 deletions packages/peregrine/lib/talons/SignIn/useSignIn.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import { useCartContext } from '../../context/cart';
import { useUserContext } from '../../context/user';
import { useAwaitQuery } from '../../hooks/useAwaitQuery';
import { retrieveCartId } from '../../store/actions/cart';
import { useDropdown } from '@magento/peregrine/lib/hooks/useDropdown';

import DEFAULT_OPERATIONS from './signIn.gql';
import { useEventingContext } from '../../context/eventing';

export const useSignIn = props => {
const {
handleTriggerClick,
getCartDetailsQuery,
setDefaultUsername,
showCreateAccount,
Expand Down Expand Up @@ -64,18 +64,11 @@ export const useSignIn = props => {
const formApiRef = useRef(null);
const setFormApi = useCallback(api => (formApiRef.current = api), []);

const { setExpanded: setCurrencyMenuIsOpen } = useDropdown();

const handleTrigger = useCallback(() => {
// Toggle Stores Menu.
setCurrencyMenuIsOpen(isOpen => !isOpen);
}, [setCurrencyMenuIsOpen]);

const handleSubmit = useCallback(
async ({ email, password }) => {
setIsSigningIn(true);
handleTrigger();

try {
// Get source cart id (guest cart id).
const sourceCartId = cartId;
Expand Down Expand Up @@ -106,15 +99,13 @@ export const useSignIn = props => {
});
const destinationCartId = await retrieveCartId();

if (destinationCartId != sourceCartId) {
// Merge the guest cart into the customer cart.
await mergeCarts({
variables: {
destinationCartId,
sourceCartId
}
});
}
// Merge the guest cart into the customer cart.
await mergeCarts({
variables: {
destinationCartId,
sourceCartId
}
});

// Ensure old stores are updated with any new data.

Expand Down Expand Up @@ -155,7 +146,7 @@ export const useSignIn = props => {
getCartDetails,
fetchCartDetails,
dispatch,
handleTrigger
handleTriggerClick
]
);

Expand Down

0 comments on commit d7ae8d6

Please sign in to comment.