-
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.
permitee column, invitation request made successfully on modal load
- Loading branch information
Showing
17 changed files
with
267 additions
and
27 deletions.
There are no files selected for viewing
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/minespace-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")); | ||
}); | ||
}; |
File renamed without changes.
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/minespace-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/minespace-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; |
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
68 changes: 68 additions & 0 deletions
68
services/minespace-web/src/components/Forms/verifiableCredentials/CreateInvitation.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,68 @@ | ||
import React, { Component } from "react"; | ||
import PropTypes from "prop-types"; | ||
import { reduxForm } from "redux-form"; | ||
import { Form } from "@ant-design/compatible"; | ||
import "@ant-design/compatible/assets/index.css"; | ||
import { Button, Popconfirm } from "antd"; | ||
import { resetForm } from "@common/utils/helpers"; | ||
import * as FORM from "@/constants/forms"; | ||
|
||
const propTypes = { | ||
handleSubmit: PropTypes.func.isRequired, | ||
createVCWalletInvitation: PropTypes.func.isRequired, | ||
closeModal: PropTypes.func.isRequired, | ||
submitting: PropTypes.bool.isRequired, | ||
partyGuid: PropTypes.string.isRequired, | ||
partyName: PropTypes.string.isRequired, | ||
invitation: PropTypes.any.isRequired, | ||
}; | ||
|
||
export class CreateInvitationForm extends Component { | ||
render() { | ||
return ( | ||
<Form layout="vertical"> | ||
<Button | ||
className="secondary" | ||
type="secondary" | ||
disabled={this.props.submitting} | ||
onClick={this.props.createVCWalletInvitation(this.props.partyGuid)} | ||
> | ||
Generate Invitation for {this.props.partyName}. | ||
</Button> | ||
<br /> | ||
<br /> | ||
<p> | ||
<b> | ||
Accept this invitation url using the digital wallet of {this.props.partyName}. to | ||
establish a secure connection for the purposes of recieving Mines Act Permits | ||
</b> | ||
</p> | ||
<br /> | ||
<Button className="primary" type="primary"> | ||
Copy to Clipboard | ||
</Button> | ||
<br /> | ||
<p></p> | ||
|
||
<Popconfirm | ||
placement="topRight" | ||
title="Are you sure you want to cancel?" | ||
onConfirm={this.props.closeModal} | ||
okText="Yes" | ||
cancelText="No" | ||
disabled={this.props.submitting} | ||
> | ||
<Button disabled={this.props.submitting}>Cancel</Button> | ||
</Popconfirm> | ||
</Form> | ||
); | ||
} | ||
} | ||
|
||
CreateInvitationForm.propTypes = propTypes; | ||
|
||
export default reduxForm({ | ||
form: FORM.CREATE_VC_CONNECTION_INVITATION, | ||
touchOnBlur: false, | ||
onSubmitSuccess: resetForm(FORM.CREATE_VC_CONNECTION_INVITATION), | ||
})(CreateInvitationForm); |
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
Oops, something went wrong.