Skip to content

Commit

Permalink
feat: added trust request types
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavkparti committed May 21, 2024
1 parent d89b603 commit a7634a4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 22 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,6 @@ import { requestTrustRelationship } from '../../../api/trust_relationships';
import Message from '../../../components/UI/components/Message/Message';
import { useTrustRelationshipsContext } from '../../../store/TrustRelationshipsContext';

const trustRequestTypeList = [
{
label: 'Send',
value: 'send',
},
{
label: 'Deduct',
value: 'deduct',
},
{
label: 'Manage',
value: 'manage',
},
];

const CreateTrustRelationship = () => {
const [dialogOpen, setDialogOpen] = useState(false);

Expand Down Expand Up @@ -88,7 +73,7 @@ const CreateNewRelationshipDialog = ({ open, handleClose }) => {
const [sendRequestError, setSendRequestError] = useState('');

const authContext = useContext(AuthContext);
const { loadData } = useTrustRelationshipsContext();
const { loadData, requestTypeList } = useTrustRelationshipsContext();

const closeDialog = () => {
setRequestSuccess(false);
Expand Down Expand Up @@ -164,6 +149,7 @@ const CreateNewRelationshipDialog = ({ open, handleClose }) => {
);
console.log(trustRelationshipRequest);
setRequestSuccess(true);
setSendRequestError('');
resetFields();
loadData();
} catch (error) {
Expand Down Expand Up @@ -215,7 +201,7 @@ const CreateNewRelationshipDialog = ({ open, handleClose }) => {
IconComponent={ArrowDropDown}
label={'Trust Request Type'}
>
{trustRequestTypeList.map((type, index) => {
{requestTypeList.map((type, index) => {
return (
<MenuItem key={index} value={type.value}>
{type.label}
Expand Down
17 changes: 16 additions & 1 deletion src/store/TrustRelationshipsContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,21 @@ const TrustRelationshipsProvider = ({ children }) => {
value: 'deduct',
color: 'black',
},
{
label: 'Receive',
value: 'receive',
color: 'black',
},
{
label: 'Release',
value: 'release',
color: 'black',
},
{
label: 'Yield',
value: 'yield',
color: 'black',
},
];

const typeList = [
Expand Down Expand Up @@ -197,7 +212,7 @@ const TrustRelationshipsProvider = ({ children }) => {
}
setCount(local_count);
const preparedRows = prepareRows(await data.trust_relationships);

setTableRows(preparedRows);
setTotalRowCount(data.total);
} catch (error) {
Expand Down

0 comments on commit a7634a4

Please sign in to comment.