diff --git a/lib/actions/link-actions.js b/lib/actions/link-actions.js new file mode 100644 --- /dev/null +++ b/lib/actions/link-actions.js @@ -0,0 +1,24 @@ +// @flow + +import type { + InviteLinkVerificationRequest, + InviteLinkVerificationResponse, +} from '../types/link-types.js'; +import type { CallServerEndpoint } from '../utils/call-server-endpoint.js'; + +const verifyInviteLinkActionTypes = Object.freeze({ + started: 'VERIFY_INVITE_LINK_STARTED', + success: 'VERIFY_INVITE_LINK_SUCCESS', + failed: 'VERIFY_INVITE_LINK_FAILED', +}); +const verifyInviteLink = + ( + callServerEndpoint: CallServerEndpoint, + ): (( + request: InviteLinkVerificationRequest, + ) => Promise) => + async request => { + return await callServerEndpoint('verify_invite_link', request); + }; + +export { verifyInviteLinkActionTypes, verifyInviteLink }; diff --git a/lib/types/redux-types.js b/lib/types/redux-types.js --- a/lib/types/redux-types.js +++ b/lib/types/redux-types.js @@ -33,6 +33,7 @@ SetCalendarDeletedFilterPayload, } from './filter-types.js'; import type { LifecycleState } from './lifecycle-state-types.js'; +import type { InviteLinkVerificationResponse } from './link-types.js'; import type { LoadingStatus, LoadingInfo } from './loading-types.js'; import type { UpdateMultimediaMessageMediaPayload } from './media-types.js'; import type { MessageReportCreationResult } from './message-report-types.js'; @@ -969,6 +970,22 @@ +error: true, +payload: Error, +loadingInfo: LoadingInfo, + } + | { + +type: 'VERIFY_INVITE_LINK_STARTED', + +loadingInfo?: LoadingInfo, + +payload?: void, + } + | { + +type: 'VERIFY_INVITE_LINK_SUCCESS', + +payload: InviteLinkVerificationResponse, + +loadingInfo: LoadingInfo, + } + | { + +type: 'VERIFY_INVITE_LINK_FAILED', + +error: true, + +payload: Error, + +loadingInfo: LoadingInfo, }; export type ActionPayload = ?(Object | Array<*> | $ReadOnlyArray<*> | string);