You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I rearchitected Accounts.js 1.0 I wanted to preserve the ability to use different databases to store the user data and the sessions (whenever the user decides to use sessions instead of JSON Web Tokens).
This is done by passing a database type parameter to the function in charge to create the module.
This way depending on the parameter the module will provide either DatabaseInterfaceUserToken, DatabaseInterfaceSessionsToken or both (not providing both of them means that another module will have to provide the other provider).
The problem is that when you want to provide both of them from the same module you cannot actually do so because useClass will instantiate two instances of the same provider.
I would like to implement the possibility of sharing the same instance of a class between multiple injectors:
The current workaround is that whenever the same module wants to provide both of them we provide DatabaseInterfaceSessionsToken using { useValue: undefined } and every time we need to access the DatabaseInterfaceSessionsToken we check if it is defined and we use DatabaseInterfaceUserToken instead whenever it is undefined. This is possible because DatabaseInterfaceUserToken must be always provided.
The text was updated successfully, but these errors were encountered:
When I rearchitected Accounts.js 1.0 I wanted to preserve the ability to use different databases to store the user data and the sessions (whenever the user decides to use sessions instead of JSON Web Tokens).
This is done by passing a database type parameter to the function in charge to create the module.
This way depending on the parameter the module will provide either
DatabaseInterfaceUserToken
,DatabaseInterfaceSessionsToken
or both (not providing both of them means that another module will have to provide the other provider).The problem is that when you want to provide both of them from the same module you cannot actually do so because
useClass
will instantiate two instances of the same provider.I would like to implement the possibility of sharing the same instance of a class between multiple injectors:
The current workaround is that whenever the same module wants to provide both of them we provide
DatabaseInterfaceSessionsToken
using{ useValue: undefined }
and every time we need to access theDatabaseInterfaceSessionsToken
we check if it is defined and we useDatabaseInterfaceUserToken
instead whenever it is undefined. This is possible becauseDatabaseInterfaceUserToken
must be always provided.The text was updated successfully, but these errors were encountered: