diff --git a/lib/socket/socket.react.js b/lib/socket/socket.react.js --- a/lib/socket/socket.react.js +++ b/lib/socket/socket.react.js @@ -15,6 +15,7 @@ } from '../shared/timeouts'; import { logInActionSources, type LogOutResult } from '../types/account-types'; import type { CalendarQuery } from '../types/entry-types'; +import { forcePolicyAcknowledgmentActionType } from '../types/policy-types.js'; import type { Dispatch } from '../types/redux-types'; import { serverRequestTypes, @@ -442,6 +443,12 @@ } else { console.log(`socket sent error ${errorMessage}`); } + if (errorMessage === 'policies_not_accepted') { + this.props.dispatch({ + type: forcePolicyAcknowledgmentActionType, + payload, + }); + } } else if (message.type === serverSocketMessageTypes.AUTH_ERROR) { const { sessionChange } = message; const cookie = sessionChange ? sessionChange.cookie : this.props.cookie; diff --git a/lib/utils/action-utils.js b/lib/utils/action-utils.js --- a/lib/utils/action-utils.js +++ b/lib/utils/action-utils.js @@ -210,6 +210,7 @@ null, endpoint, data, + dispatch, options, ); if (callServerEndpointCallback) { @@ -351,6 +352,7 @@ socketAPIHandler, endpoint, data, + dispatch, options, ); } diff --git a/lib/utils/call-server-endpoint.js b/lib/utils/call-server-endpoint.js --- a/lib/utils/call-server-endpoint.js +++ b/lib/utils/call-server-endpoint.js @@ -9,6 +9,8 @@ endpointIsSocketPreferred, endpointIsSocketOnly, } from '../types/endpoints'; +import { forcePolicyAcknowledgmentActionType } from '../types/policy-types.js'; +import type { Dispatch } from '../types/redux-types.js'; import type { ServerSessionChange, ClientSessionChange, @@ -82,6 +84,7 @@ socketAPIHandler: ?SocketAPIHandler, endpoint: Endpoint, input: { [key: string]: mixed }, + dispatch: Dispatch, options?: ?CallServerEndpointOptions, ): Promise { const possibleReplacement = await waitIfCookieInvalidated(); @@ -195,7 +198,13 @@ setNewSession(clientSessionChange, error); } - if (error) { + if (error === 'policies_not_accepted') { + dispatch({ + type: forcePolicyAcknowledgmentActionType, + payload, + }); + return; + } else if (error) { throw new ServerError(error, payload); } options?.getResultInfo?.({ interface: 'REST' });