Created
January 10, 2020 10:42
-
-
Save lpillonel/17a6f906674d472868602723e136a606 to your computer and use it in GitHub Desktop.
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
import React, { useMemo, useEffect } from 'react' | |
import IMTFPlugins from 'IMTFPlugins' | |
export default function MyTaskInspector({ item }) { | |
const caseRefOid = item.getIn(['caseRef', 'oid']) | |
const casePayload = IMTFPlugins.hooks.case.usePayload(caseRefOid) | |
return ( | |
<div> | |
KYC Officer name : {casePayload && casePayload.get('kycOfficerName')} | |
</div> | |
) | |
} | |
export function MyTaskInspectorAlternative({ item }) { | |
const caseRefOid = item.getIn(['caseRef', 'oid']) | |
const { | |
requests: { case: getPayload }, | |
selector: { | |
useSelector, | |
case: { createPayloadSelector }, | |
}, | |
} = IMTFPlugins | |
const selector = useMemo(() => createPayloadSelector(caseRefOid), [ | |
caseRefOid, | |
createPayloadSelector, | |
]) | |
const casePayload = useSelector(selector) | |
useEffect(() => { | |
if (casePayload === undefined) { | |
getPayload(caseRefOid) | |
} | |
}, [casePayload, caseRefOid, getPayload]) | |
return ( | |
<div> | |
KYC Officer name : {casePayload && casePayload.get('kycOfficerName')} | |
</div> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment