Tidy up bapsiclesession

This commit is contained in:
Matthew Stratford 2021-05-31 21:51:20 +01:00
parent eef88c9e48
commit e5bd90fbe3
2 changed files with 4 additions and 63 deletions

View file

@ -47,7 +47,9 @@ export function ConnectionDialogue({ error }: { error: String | null }) {
const SessionHandler: React.FC = function() {
const dispatch = useDispatch();
const { connectionState } = useSelector((state: RootState) => state.session);
const { connectionState } = useSelector(
(state: RootState) => state.bapsSession
);
switch (connectionState) {
case "CONNECTED":
@ -60,42 +62,6 @@ const SessionHandler: React.FC = function() {
dispatch(SessionState.getServer());
return null;
}
/* return (
<div>
<LoadingDialogue
title="Getting User..."
subtitle={userLoading ? "Hang on a sec..." : ""}
error={userLoadError}
percent={39}
/>
{userLoadError !== null &&
userLoadError !== undefined &&
!userLoading &&
redirectToLogin()}
</div>
); */
/*
if (currentTimeslot === null) {
return (
<div>
<LoadingDialogue
title="Getting Timeslot..."
subtitle={timeslotLoading ? "Hang on a sec..." : ""}
error={userLoadError}
percent={71}
/>
{currentTimeslot === null &&
timeslotLoadError == null &&
timeslotLoadError !== undefined &&
!timeslotLoading &&
redirectToTimeslotSelect()}
</div>
);
}
*/
return <p></p>;
};
export default SessionHandler;

View file

@ -64,7 +64,7 @@ export default sessionState.reducer;
export const { setServerState } = sessionState.actions;
export const getCurrentServer = (): AppThunk => async (dispatch, getState) => {
return getState().session.currentServer;
return getState().bapsSession.currentServer;
};
export const getServer = (): AppThunk => async (dispatch) => {
@ -76,29 +76,4 @@ export const getServer = (): AppThunk => async (dispatch) => {
};
dispatch(sessionState.actions.setCurrentServer({ server: bapsServer }));
dispatch(connectBAPSicle("ws://" + window.location.hostname + ":13501"));
/*
dispatch(sessionState.actions.getUserStarting());
try {
const [user, canBroadcast] = await Promise.all([
getCurrentApiUser(),
doesCurrentUserHavePermission(BROADCAST_PERMISSION_ID),
]);
dispatch(sessionState.actions.setCurrentUser({ user, canBroadcast }));
} catch (e) {
console.log("failed to get user. " + e.toString());
dispatch(sessionState.actions.getUserError(e.toString()));
}
*/
};
/* export const getTimeslot = (): AppThunk => async (dispatch) => {
dispatch(sessionState.actions.getTimeslotStarting());
try {
const timeslot = await getCurrentApiTimeslot();
dispatch(sessionState.actions.getTimeslotSuccess(timeslot));
} catch (e) {
console.log("failed to get selected timeslot. " + e.toString());
dispatch(sessionState.actions.getTimeslotError(e.toString()));
}
};
*/