-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
services/core-web/common/actionCreators/verifiableCredentialActionCreator.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { notification } from "antd"; | ||
import { ENVIRONMENT } from "@mds/common"; | ||
import { request, success, error } from "../actions/genericActions"; | ||
import * as reducerTypes from "../constants/reducerTypes"; | ||
import * as verfiableCredentialActions from "../actions/verfiableCredentialActions"; | ||
import { createRequestHeader } from "../utils/RequestHeaders"; | ||
import { showLoading, hideLoading } from "react-redux-loading-bar"; | ||
import CustomAxios from "../customAxios"; | ||
|
||
export const createVCWalletInvitation = (party_guid) => (dispatch) => { | ||
dispatch(showLoading("modal")); | ||
dispatch(request(reducerTypes.CREATE_VC_WALLET_CONNECTION_INVITATION)); | ||
return CustomAxios() | ||
.post( | ||
`${ENVIRONMENT.apiUrl}/verifiable-credentials/oob-invitation/${party_guid}`, | ||
null, | ||
createRequestHeader() | ||
) | ||
.then((response) => { | ||
dispatch(success(reducerTypes.CREATE_VC_WALLET_CONNECTION_INVITATION)); | ||
dispatch(verfiableCredentialActions.storeVCConnectionInvitation(response.data)); | ||
dispatch(hideLoading("modal")); | ||
}) | ||
.catch((err) => { | ||
notification.error({ | ||
message: err.response ? err.response.data.message : String.ERROR, | ||
duration: 10, | ||
}); | ||
dispatch(error(reducerTypes.CREATE_VC_WALLET_CONNECTION_INVITATION)); | ||
dispatch(hideLoading("modal")); | ||
}); | ||
}; |
6 changes: 6 additions & 0 deletions
6
services/core-web/common/actions/verfiableCredentialActions.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import * as ActionTypes from "../constants/actionTypes"; | ||
|
||
export const storeVCConnectionInvitation = (payload) => ({ | ||
type: ActionTypes.STORE_VC_WALLET_CONNECTION_INVITATION, | ||
payload, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
services/core-web/common/reducers/verifiableCredentialReducer.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import * as actionTypes from "../constants/actionTypes"; | ||
import { VERIFIABLE_CREDENTIALS } from "../constants/reducerTypes"; | ||
|
||
/** | ||
* @file verifiableCredentialReducer.js | ||
* all data associated with verificable credential records. | ||
*/ | ||
|
||
const initialState = { | ||
vcWalletConnectionInvitation: {}, | ||
}; | ||
|
||
const verifiableCredentialReducer = (state = initialState, action) => { | ||
switch (action.type) { | ||
case actionTypes.STORE_VC_WALLET_CONNECTION_INVITATION: | ||
return { | ||
...state, | ||
vcWalletConnectionInvitation: action.payload, | ||
}; | ||
default: | ||
return state; | ||
} | ||
}; | ||
|
||
const verifiableCredentialReducerObject = { | ||
[VERIFIABLE_CREDENTIALS]: verifiableCredentialReducer, | ||
}; | ||
|
||
export const getVCWalletConnectionInvitation = (state) => | ||
state[VERIFIABLE_CREDENTIALS].vcWalletConnectionInvitation; | ||
|
||
export default verifiableCredentialReducerObject; |
3 changes: 3 additions & 0 deletions
3
services/core-web/common/selectors/verifiableCredentialSelectors.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import * as verifiableCredentialReducer from "../reducers/verifiableCredentialReducer"; | ||
|
||
export const { getVCWalletConnectionInvitation } = verifiableCredentialReducer; |