diff --git a/lib/components/keyserver-connection-handler.js b/lib/components/keyserver-connection-handler.js --- a/lib/components/keyserver-connection-handler.js +++ b/lib/components/keyserver-connection-handler.js @@ -10,7 +10,10 @@ useLogOut, } from '../actions/user-actions.js'; import { extractKeyserverIDFromID } from '../keyserver-conn/keyserver-call-utils.js'; -import { setNewSession } from '../keyserver-conn/keyserver-conn-types.js'; +import { + setNewSession, + CANCELLED_ERROR, +} from '../keyserver-conn/keyserver-conn-types.js'; import { resolveKeyserverSessionInvalidation } from '../keyserver-conn/recovery-utils.js'; import { filterThreadIDsInFilterList } from '../reducers/calendar-filters-reducer.js'; import { @@ -42,7 +45,6 @@ }; const AUTH_RETRY_DELAY_MS = 60000; -const CANCELLED_ERROR = 'cancelled'; function KeyserverConnectionHandler(props: Props) { const { socketComponent: Socket, ...socketProps } = props; diff --git a/lib/keyserver-conn/keyserver-conn-types.js b/lib/keyserver-conn/keyserver-conn-types.js --- a/lib/keyserver-conn/keyserver-conn-types.js +++ b/lib/keyserver-conn/keyserver-conn-types.js @@ -33,8 +33,8 @@ startingPayload: LogInStartingPayload, ) => Promise; -const setNewSessionActionType = 'SET_NEW_SESSION'; -function setNewSession( +export const setNewSessionActionType = 'SET_NEW_SESSION'; +export function setNewSession( dispatch: Dispatch, sessionChange: ClientSessionChange, preRequestUserState: ?PreRequestUserState, @@ -95,4 +95,6 @@ export const setActiveSessionRecoveryActionType = 'SET_ACTIVE_SESSION_RECOVERY'; -export { setNewSessionActionType, setNewSession }; +// We pass this string to the Error constructor when dispatching a _FAILED +// action via throwing in the promise that we pass to dispatchActionPromise +export const CANCELLED_ERROR = 'cancelled';