我正在创建一个下拉列表(使用选择字段),我想在下拉列表中获取以下 6 个环境,目前默认值为 MMP_SSL,因此 httpLink SERVER_URL 设置为 MMP_SSL。
那么我想改成SD,httpLink SERVER_URL 应该是SD。在 EnvironmentChange 函数中,我正在更改此值,这 6 个值来自一个数组。
LOCAL: 'http://localhost:4000',
LOCAL_IOS: 'http://172.0.0.0', //change the ip address with the IP of your laptop
LOCAL_DEMO: 'http://kaushikna.run', // Pointing to Local environment through internet
MMP: 'http://dclm-mmp1.cluster1.-service',
MMP_SSL: 'https://bssmo-service', //E2E environment
SD: 'http://dclmapps.19dclm-service', // Pointing to SD environment
const httpLink = createHttpLink({
uri: SERVER_URL.MMP_SSL
});
EnvironmentChange = (key, val) => {
this.handleLanguageChange({ field: "preferredEnv" }, val);
};
handleLanguageChange = (props, e) => {
let tempObj = this.state.preferredEnv;
tempObj[props.field] = e;
this.setState({ preferredEnv: e });
};
let envData = [];
masterData.language.map(({ code: value, name: label }) => {
envData.push({ value, label });
});
<SelectField
label="Environment"
node="presentationLanguage"
options={envData}
value={"MMP_SSL"}
onChange={this.EnvironmentChange}
that={this}
setIcon={true}
/>