I'm creating a new custom module for
jira:customField:
When i try to use
import {fetch} from "@forge/api";
useEffect(() => {fetch("XXXXXXXX").then(resp => {console.info(resp) })}, []);
Just as an example to get a list of data from a json endpoint to populate the select list, I don't see this output in the tunnel logs or browser console.Here is a demo example also not firing
const [test, setTest] = useState([])useEffect(() => {fetch("https://myapi.com/resp.json").then(resp => {setTest([{label: "test", value: "123"}]) }) }, []);return (<CustomFieldEdit onSubmit={onSubmit}> <Select label="Harvest Work Orders" name="harvestworkorders"> {test.map(el => {return <Option label={el.label} value={el.value} /> })}</Select> </CustomFieldEdit>);
The mainfest file allows this call I've hardcoded a response to set just for testing but still nothing occurs, if I remove the fetch the hardcode works so it seems using fetch doesn't trigger the external api call but I cannot fathom as too why, This seems to work fine if I create a
jira:issueContext
but ideally this would be better as a custom form field but perhaps this is not possible and I will have to go down the other route?
For anyone else that comes across this I ended up going down the custom field context to pre-populate values. Which is OK for my use case.
It looks like you're new here. Sign in or register to get started.