mirror of
				https://github.com/songquanpeng/one-api.git
				synced 2025-11-04 15:53:42 +08:00 
			
		
		
		
	fix: key is wrongly updated
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user