in frontend/src/auth/SignInButton.js [73:92]
async function setAuthListeners() {
Hub.listen('auth', ({ payload }) => {
switch (payload.event) {
case 'signIn':
fetchSetUserInfoVotes(userDispatch, voteDispatch, payload.data.signInUserSession, channelArn);
break;
default: // case: 'signOut'
userDispatch({ type: SET_SIGNED_OUT_USER_ACTION });
voteDispatch({ type: CLEAR_VOTES_ACTION });
break;
}
});
try {
const user = await Auth.currentAuthenticatedUser();
fetchSetUserInfoVotes(userDispatch, voteDispatch, user.signInUserSession, channelArn);
} catch(e) {
userDispatch({ type: SET_SIGNED_OUT_USER_ACTION });
voteDispatch({ type: CLEAR_VOTES_ACTION });
}
}