-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed cancel action in cross window does not close child window (#1345)
* yarn.lock * Fixed cancel action in cross window * Fixed cancel action in cross window does not close child window
- Loading branch information
1 parent
b1270eb
commit fa7f275
Showing
4 changed files
with
28 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { CrossWindowProvider } from '@multiversx/sdk-web-wallet-cross-window-provider/out'; | ||
import { useGetAccountProvider } from 'hooks/account/useGetAccountProvider'; | ||
import { LoginMethodsEnum } from 'types'; | ||
import { getIsProviderEqualTo } from 'utils/account/getIsProviderEqualTo'; | ||
|
||
export function useCancelCrossWindowAction() { | ||
const { provider } = useGetAccountProvider(); | ||
|
||
return async () => { | ||
if (!provider) { | ||
return; | ||
} | ||
|
||
if (getIsProviderEqualTo(LoginMethodsEnum.crossWindow)) { | ||
const crossWindowProvider = provider as unknown as CrossWindowProvider; | ||
await crossWindowProvider.cancelAction(); | ||
await crossWindowProvider.dispose(); | ||
} | ||
}; | ||
} |
File renamed without changes.