diff --git a/services/core-web/common/actionCreators/verifiableCredentialActionCreator.ts b/services/core-web/common/actionCreators/verifiableCredentialActionCreator.ts index 7a385a2a18..79d8e19949 100644 --- a/services/core-web/common/actionCreators/verifiableCredentialActionCreator.ts +++ b/services/core-web/common/actionCreators/verifiableCredentialActionCreator.ts @@ -34,3 +34,28 @@ export const createVCWalletInvitation = ( throw new Error(err); }); }; + +export const fetchVCWalletInvitations = ( + partyGuid: string +): AppThunk>> => ( + dispatch +): Promise> => { + dispatch(showLoading("modal")); + dispatch(request(reducerTypes.FETCH_VC_WALLET_CONNECTION_INVITATIONS)); + return CustomAxios() + .get( + `${ENVIRONMENT.apiUrl}/verifiable-credentials/oob-invitation/${partyGuid}`, + createRequestHeader() + ) + .then((response) => { + dispatch(success(reducerTypes.FETCH_VC_WALLET_CONNECTION_INVITATIONS)); + dispatch(verfiableCredentialActions.storeVCConnectionInvitation(response.data)); + dispatch(hideLoading("modal")); + return response; + }) + .catch((err) => { + dispatch(error(reducerTypes.FETCH_VC_WALLET_CONNECTION_INVITATIONS)); + dispatch(hideLoading("modal")); + throw new Error(err); + }); +}; diff --git a/services/core-web/common/constants/reducerTypes.js b/services/core-web/common/constants/reducerTypes.js index 7c7e2393d4..fe34fbe3da 100644 --- a/services/core-web/common/constants/reducerTypes.js +++ b/services/core-web/common/constants/reducerTypes.js @@ -310,3 +310,4 @@ export const GET_GLOBAL_ALERTS = "GET_GLOBAL_ALERTS"; //Verficable Credentials export const VERIFIABLE_CREDENTIALS = "VERIFIABLE_CREDENTIALS"; export const CREATE_VC_WALLET_CONNECTION_INVITATION = "CREATE_VC_WALLET_CONNECTION_INVITATION"; +export const FETCH_VC_WALLET_CONNECTION_INVITATIONS = "FETCH_VC_WALLET_CONNECTION_INVITATIONS";