Still can't register on my frontend
curl -X 'POST' \                                     ✔  system  
  'http://localhost:3001/user/register' \
  -H 'accept: */*' \
  -H 'Content-Type: application/json' \
  -d '{
  "username": "string1",
  "password1": "string1",
  "password2": "string1",
  "resigterCode": "string1"
}'
{"code":200,"data":{"identifiers":[{"id":"2"}],"generatedMaps":[{"id":"2","status":1,"createdAt":"2023-05-30T09:35:01.999Z","updatedAt":"2023-05-30T09:35:01.999Z","userType":"1"}],"raw":{"fieldCount":0,"affectedRows":1,"insertId":2,"info":"","serverStatus":2,"warningStatus":0}},"message":"success"}


import React, { useState } from 'react';
import axios from 'axios';
import { useHistory } from 'react-router-dom';

const Register = () => {
  const [username, setUsername] = useState('');
  const [password, setPassword] = useState('');
  const [password2, setPassword2] = useState('');
  const [registerCode, setRegisterCode] = useState('');
  const [error, setError] = useState(null);
  const [success, setSuccess] = useState(false);

  const history = useHistory();

  const handleSubmit = async (e) => {
    e.preventDefault();

    try {
      const response = await axios.post('http://localhost:3001/user/register', {
        username,
        password,
        password2,
        registerCode,
      });

      if (response.data.code === 200 && response.data.message === 'success') {
        setSuccess(true);
        setError(null);
        history.push('/login');
      } else {
        setError('Registration failed');
        setSuccess(false);
      }
    } catch (err) {
      setError('Registration failed');
      setSuccess(false);
    }
  };

  return (
    <div>
      <h2>Register</h2>
      <form onSubmit={handleSubmit}>
        <div className="form-group">
          <label>Username</label>
          <input
            type="text"
            className="form-control"
            value={username}
            onChange={(e) => setUsername(e.target.value)}
            required
          />
        </div>
        <div className="form-group">
          <label>Password</label>
          <input
            type="password"
            className="form-control"
            value={password}
            onChange={(e) => setPassword(e.target.value)}
            required
          />
        </div>
        <div className="form-group">
          <label>Confirm Password</label>
          <input
            type="password"
            className="form-control"
            value={password2}
            onChange={(e) => setPassword2(e.target.value)}
            required
          />
        </div>
        <div className="form-group">
          <label>Register Code</label>
          <input
            type="text"
            className="form-control"
            value={registerCode}
            onChange={(e) => setRegisterCode(e.target.value)}
            required
          />
        </div>
        <button type="submit" className="btn btn-primary">Register</button>
      </form>
      {success && <p>Registration successful</p>}
      {error && <p>{error}</p>}
    </div>
  );
};

export default Register;


THIS IS MY API CODE
  /**
   * Register
   * @param req CreateUserRequest
   * @returns InsertResult
   */
  @Post('register')
  @ApiOperation({ summary: 'Register' })
  async register(@Body() req: CreateUserRequest) {
    if (req.password1 != req.password2) {
      throw new ApiException(ErrorEnum.CODE_1003);
    }

    const entity = new UserEntity();
    entity.userName = req.username;
    entity.password = req.password1;
    if (req.resigterCode != null && req.resigterCode !== '') {
      // TODO: Verify the correctness of the Resigter code
      entity.resigterCode = req.resigterCode;
      entity.userType = '1';
    }
    console.info(entity);
    return this.userService.create(entity);
  }