EOSIO / EOSIO/ual-plainjs-renderer

AutoLogin not working with ng build --prod

Open
#85 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11
Forks
20
PR merge metrics
No merged PRs in 30d

Description

I'm trying to implement Anchor and Wax login with UAL in an angular app. Everything works fine except when I refresh my page UAL is unable to find the logged in user from session. This is happening because 'ual-session-authenticator' is not saved. The value for 'ual-session-authenticator' in localStorage is always null because it is saved by ```localStorage.setItem(UALJs.SESSION_AUTHENTICATOR_KEY, authenticator.constructor.name);```
in UALJs . And on page refresh when it tries to find the session authenticator it couldnt because it also uses
```const sessionAuthenticator = authenticators.find((authenticator) => authenticator.constructor.name === authenticatorName);```

This only happens with ```ng serve --prod --sourceMap``` and ```ng build --prod```. Dev build ```ng serve``` works fine. Angular uglify class names for prod builds.
A better way is to use instanceof instead of constructor.name

Angular CLI: 11.0.5
Node: 14.15.0
OS: win32 x64

Angular: 11.0.5
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1100.5
@angular-devkit/build-angular 0.1100.5
@angular-devkit/core 11.0.5
@angular-devkit/schematics 11.0.5
@schematics/angular 11.0.5
@schematics/update 0.1100.5
rxjs 6.6.3
typescript 4.0.3

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.