Skip to content

Commit

Permalink
update skip method to clear only initiated login state (#1298)
Browse files Browse the repository at this point in the history
* update skip method to clear only initiated login state

* Update CHANGELOG.md

* rename to intiatedLoginMethod
  • Loading branch information
DanutIlie authored Nov 4, 2024
1 parent 53e1dc3 commit 3d72b71
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,44 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- [Update skip method to clear only initiated login state](https://github.com/multiversx/mx-sdk-dapp/pull/1298)

## [[v3.0.7](https://github.com/multiversx/mx-sdk-dapp/pull/1296)] - 2024-11-01

- [Updated Iframe provider imports](https://github.com/multiversx/mx-sdk-dapp/pull/1297)
- [Fixed Iframe provider reload](https://github.com/multiversx/mx-sdk-dapp/pull/1295)

## [[v3.0.6](https://github.com/multiversx/mx-sdk-dapp/pull/1294)] - 2024-11-01

- [Fixed `location.assign` in extension context](https://github.com/multiversx/mx-sdk-dapp/pull/1293)

## [[v3.0.5](https://github.com/multiversx/mx-sdk-dapp/pull/1292)] - 2024-11-01

- [Added ability to close modal on Escape key press](https://github.com/multiversx/mx-sdk-dapp/pull/1291)

## [[v3.0.4](https://github.com/multiversx/mx-sdk-dapp/pull/1290)] - 2024-10-31

- [Update passkey provider to use sign modals](https://github.com/multiversx/mx-sdk-dapp/pull/1289)
- [Fixed sass warnings](https://github.com/multiversx/mx-sdk-dapp/pull/1288)

## [[v3.0.3](https://github.com/multiversx/mx-sdk-dapp/pull/1287)] - 2024-10-28

- [Fixed ledger shows redundant error on login](https://github.com/multiversx/mx-sdk-dapp/pull/1286)

## [[v3.0.2](https://github.com/multiversx/mx-sdk-dapp/pull/1285)] - 2024-10-22

- [Upgrade @multiversx/sdk-passkey-provider](https://github.com/multiversx/mx-sdk-dapp/pull/1284)

## [[v3.0.1](https://github.com/multiversx/mx-sdk-dapp/pull/1283)] - 2024-10-22

- [Upgrade sdk-core to v.13.12.0](https://github.com/multiversx/mx-sdk-dapp/pull/1282)

## [⚠️ Breaking ⚠️[v3.0.0](https://github.com/multiversx/mx-sdk-dapp/pull/1281)] - 2024-10-21

- [Upgrade providers login methods & signMessage. Upgrade sdk-core to v.13](https://github.com/multiversx/mx-sdk-dapp/pull/1279)

## [[v2.40.11](https://github.com/multiversx/mx-sdk-dapp/pull/1280)] - 2024-10-09

- [Fixed axios interceptor concurrent calls](https://github.com/multiversx/mx-sdk-dapp/pull/1279)

## [[v2.40.10](https://github.com/multiversx/mx-sdk-dapp/pull/1277)] - 2024-10-04
Expand Down
6 changes: 4 additions & 2 deletions src/hooks/login/helpers/clearInitiatedLogins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import { CrossWindowProvider } from 'lib/sdkWebWalletCrossWindowProvider';
import { IframeProvider } from 'lib/sdkWebWalletIframeProvider';
import { LoginMethodsEnum } from 'types';

export const clearInitiatedLogins = (props?: { skip: LoginMethodsEnum }) => {
export const clearInitiatedLogins = (props?: {
intiatedLoginMethod: LoginMethodsEnum;
}) => {
Object.values(LoginMethodsEnum).forEach((method) => {
if (props?.skip && method === props.skip) {
if (props?.intiatedLoginMethod && method !== props.intiatedLoginMethod) {
return;
}
const crossWindowProvider = CrossWindowProvider.getInstance();
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/login/useCrossWindowLogin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const useCrossWindowLogin = ({
}

clearInitiatedLogins({
skip: LoginMethodsEnum.crossWindow
intiatedLoginMethod: LoginMethodsEnum.crossWindow
});

setIsLoading(true);
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/login/useIframeLogin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const useIframeLogin = ({
}

clearInitiatedLogins({
skip: LoginMethodsEnum.iframe
intiatedLoginMethod: LoginMethodsEnum.iframe
});

setIsLoading(true);
Expand Down

0 comments on commit 3d72b71

Please sign in to comment.