fix: key is wrongly updated

This commit is contained in:
JustSong 2024-04-21 17:38:39 +08:00
parent 541182102e
commit d14e4aa01b

View File

@ -57,7 +57,8 @@ const EditChannel = () => {
const [config, setConfig] = useState({
region: '',
sk: '',
ak: ''
ak: '',
user_id: ''
});
const handleInputChange = (e, { name, value }) => {
setInputs((inputs) => ({ ...inputs, [name]: value }));
@ -156,8 +157,10 @@ const EditChannel = () => {
}, []);
const submit = async () => {
if (inputs.key === "") {
inputs.key = `${config.ak}|${config.sk}|${config.region}`;
if (inputs.key === '') {
if (config.ak !== '' && config.sk !== '' && config.region !== '') {
inputs.key = `${config.ak}|${config.sk}|${config.region}`;
}
}
if (!isEdit && (inputs.name === '' || inputs.key === '')) {
showInfo('请填写渠道名称和渠道密钥!');
@ -442,6 +445,18 @@ const EditChannel = () => {
</Form.Field>
)
}
{
inputs.type === 34 && (
<Form.Input
label='User ID'
name='user_id'
required
placeholder={'生成该密钥的用户 ID'}
onChange={handleConfigChange}
value={config.user_id}
autoComplete=''
/>)
}
{
inputs.type !== 33 && (batch ? <Form.Field>
<Form.TextArea