Fix another first-launch bug
This commit is contained in:
@@ -238,13 +238,11 @@ export const ClientConfigStore: FC = () => {
|
|||||||
try {
|
try {
|
||||||
sendEvent(AppStateEvent.NeedsRegister);
|
sendEvent(AppStateEvent.NeedsRegister);
|
||||||
const response = await ChatService.registerUser(optionalDisplayName);
|
const response = await ChatService.registerUser(optionalDisplayName);
|
||||||
console.log(`ChatService -> registerUser() response: \n${response}`);
|
|
||||||
const { accessToken: newAccessToken, displayName: newDisplayName, displayColor } = response;
|
const { accessToken: newAccessToken, displayName: newDisplayName, displayColor } = response;
|
||||||
if (!newAccessToken) {
|
if (!newAccessToken) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('setting access token', newAccessToken);
|
|
||||||
setCurrentUser({
|
setCurrentUser({
|
||||||
...currentUser,
|
...currentUser,
|
||||||
displayName: newDisplayName,
|
displayName: newDisplayName,
|
||||||
@@ -399,10 +397,6 @@ export const ClientConfigStore: FC = () => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
appStateService.onTransition(state => {
|
appStateService.onTransition(state => {
|
||||||
if (!state.changed) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const metadata = mergeMeta(state.meta) as AppStateOptions;
|
const metadata = mergeMeta(state.meta) as AppStateOptions;
|
||||||
|
|
||||||
// console.debug('--- APP STATE: ', state.value);
|
// console.debug('--- APP STATE: ', state.value);
|
||||||
|
|||||||
@@ -57,12 +57,12 @@ const GOODBYE_STATE: AppStateOptions = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export enum AppStateEvent {
|
export enum AppStateEvent {
|
||||||
Loading = 'LOADING',
|
Loading = 'LOADING', // Have not pulled configuration data from the server.
|
||||||
Loaded = 'LOADED',
|
Loaded = 'LOADED', // Configuration data has been pulled from the server.
|
||||||
Online = 'ONLINE',
|
Online = 'ONLINE', // Stream is live
|
||||||
Offline = 'OFFLINE', // Have not pulled configuration data from the server.
|
Offline = 'OFFLINE', // Stream is not live
|
||||||
NeedsRegister = 'NEEDS_REGISTER',
|
NeedsRegister = 'NEEDS_REGISTER', // Needs to register a chat user
|
||||||
Fail = 'FAIL',
|
Fail = 'FAIL', // Error
|
||||||
}
|
}
|
||||||
|
|
||||||
const appStateModel =
|
const appStateModel =
|
||||||
@@ -73,9 +73,7 @@ const appStateModel =
|
|||||||
predictableActionArguments: true,
|
predictableActionArguments: true,
|
||||||
states: {
|
states: {
|
||||||
loading: {
|
loading: {
|
||||||
meta: {
|
meta: LOADING_STATE,
|
||||||
...LOADING_STATE,
|
|
||||||
},
|
|
||||||
on: {
|
on: {
|
||||||
NEEDS_REGISTER: {
|
NEEDS_REGISTER: {
|
||||||
target: 'loading',
|
target: 'loading',
|
||||||
|
|||||||
Reference in New Issue
Block a user