Fixed null pointer handling in login / QPL flow
Summary: Found an NPE during testing a prod build that I encountered a few times before, which occurs when the user isn't logged in. Maked types stricter and this probably fixes an old bug where login status icon could be out of sync as well. Reviewed By: nikoant Differential Revision: D27589740 fbshipit-source-id: 419aaca77a997e01e8d9b0067e604a8dad019551
This commit is contained in:
committed by
Facebook GitHub Bot
parent
9f8b6e149a
commit
7a45941973
@@ -21,7 +21,11 @@ export default (store: Store, _logger: Logger) => {
|
|||||||
|
|
||||||
getUser()
|
getUser()
|
||||||
.then((user) => {
|
.then((user) => {
|
||||||
|
if (user) {
|
||||||
store.dispatch(login(user));
|
store.dispatch(login(user));
|
||||||
|
} else {
|
||||||
|
store.dispatch(logout());
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
store.dispatch(logout());
|
store.dispatch(logout());
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
import {Atom, createState} from 'flipper-plugin';
|
import {Atom, createState} from 'flipper-plugin';
|
||||||
import {User} from '../reducers/user';
|
import {User} from '../reducers/user';
|
||||||
|
|
||||||
export async function getUser(): Promise<User> {
|
export async function getUser(): Promise<User | null> {
|
||||||
throw new Error('Feature not implemented');
|
throw new Error('Feature not implemented');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user