ModuleAPI: overwrite_login
action was not stopping the existing client resulting in the action failing with rust-sdk (#12272)
* Fix overwrite login action not stopping client * remove unneeded fixture for overwrite login test * Fix playwrite bad import of app sources * revert uneeded change on fore OnLoggedIn causing side effects * Add unit test for overwrite login action * remove un needed ts-ignore
This commit is contained in:
parent
b9bdd18666
commit
8a70260c81
4 changed files with 146 additions and 5 deletions
|
@ -160,6 +160,12 @@ export class ProxiedModuleApi implements ModuleApi {
|
|||
* @override
|
||||
*/
|
||||
public async overwriteAccountAuth(accountInfo: AccountAuthInfo): Promise<void> {
|
||||
// We want to wait for the new login to complete before returning.
|
||||
// See `Action.OnLoggedIn` in dispatcher.
|
||||
const awaitNewLogin = new Promise<void>((resolve) => {
|
||||
this.overrideLoginResolve = resolve;
|
||||
});
|
||||
|
||||
dispatcher.dispatch<OverwriteLoginPayload>(
|
||||
{
|
||||
action: Action.OverwriteLogin,
|
||||
|
@ -172,9 +178,7 @@ export class ProxiedModuleApi implements ModuleApi {
|
|||
); // require to be sync to match inherited interface behaviour
|
||||
|
||||
// wait for login to complete
|
||||
await new Promise<void>((resolve) => {
|
||||
this.overrideLoginResolve = resolve;
|
||||
});
|
||||
await awaitNewLogin;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue