Comments (1)
How to share current user information to sub-applications after logging in from the main application?
Three options:
- Use single-spa custom props, which were created for this purpose
- Use a global variable
window.loggedInUser
. I've done this before and it's not bad as long as you don't end up modifying the global variables. - Create a module in the import map called
auth
that exports a variable called user. Applications then use this variable viaimport {user} from 'auth'
. Make sure to excludeauth
from your webpack build by adding auth as a webpack external
Are there any other better ways besides localStorage?
Yes, I think all of the options listed above are better than localStorage, since making auth data persist when you reload the page can lead to funky bugs. Auth data is better checked from a cookie and the API rather than a local storage value that can become stale.
If the application is internationalized, how do other applications listen after the main application switches languages?
Internationalization can be done in the same way described in the Angular docs. In those docs, it suggests creating a separate bundle for each locale, along with a distinct base url inside the browser for each locale. Since each locale has entirely separate js files, you'll need to do a full page reload when switching locales. A full page reload can be accomplished with <a href="/fr"></a>
iirc
I am closing this issue since I've answered the questions. Feel free to reopen or comment further with any other discussion related to this.
from coexisting-angular-microfrontends.
Related Issues (20)
- Upgrade an example with Angular 13. HOT 1
- Use IDE Debugger HOT 1
- how can I integrate a new angular application in another angular in a specific location?
- Import an utility module into microfrontend Angular
- Pending depdendencies pull requests
- Upgrade to SystemJS 6
- single spa won't display two apps at the same time HOT 5
- How to Build "coexisting-angular-microfrontends"? HOT 7
- Styles overlapping and not able to unmount while switching from one app to another HOT 1
- Can we have Proxy HOT 5
- App.component not rendered HOT 2
- app1 does not load HOT 1
- Issue with $localize() after upgrading to angular 9 HOT 2
- Navbar died in status SKIP_BECAUSE_BROKEN HOT 4
- Nested (Child) Routes in Angular HOT 1
- After building , navigating to "app1" gives 404 HOT 3
- set live load to true not working
- seems not work... HOT 1
- Current status of support HOT 3
- live reload HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from coexisting-angular-microfrontends.