Skip to content

Instantly share code, notes, and snippets.

@sazzer
Created March 16, 2018 17:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sazzer/cc26caaf61ccc5216049f2d04e2e6aa1 to your computer and use it in GitHub Desktop.
Save sazzer/cc26caaf61ccc5216049f2d04e2e6aa1 to your computer and use it in GitHub Desktop.
Can Unstateful Containers see each other?
type LoginProvidersState = {
+loadedState: string,
+providers: {
[key: string]: string
}
};
export class LoginProvidersContainer extends Container<LoginProvidersState> {
state = {
loadedState: PENDING,
providers: {} // This is a map of Provider ID onto a URI to start authentication
};
// More code in here
}
type AccessToken = {
+token: string,
+expires: string
};
type AccessTokenState = {
+token: ?AccessToken
};
export class AccessTokenContainer extends Container<AccessTokenState> {
state = {};
async authenticate(provider) {
// Can this get the Authentication URI from the LoginProvidersContainer?
// Or must it be that the calling code looks it up in one Container and provides it to the other?
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment