错误注册Nodejs(错误名称未解决)

问题描述 投票:0回答:1

const handleFileInputChange = (e) => {
  const file = e.target.files[0];
  setAvatar(file);
};
const handleSubmit = async (e) => {
  e.preventDefault();
  const config = { headers: { "Content-Type": "multipart/form-data" } };
  const newForm = new FormData();
  newForm.append("file", avatar);
  newForm.append("name", name);
  newForm.append("email", email);
  newForm.append("password", password);
  axios
    .post(`${server}/user/create-user`, newForm, config)
    .then((res) => {
      toast.success(res.data.message);
      setName("");
      setEmail("");
      setPassword("");
      setAvatar();
    })
    .catch((error) => {
      toast.error(error.message);
    });
};
javascript node.js browser
1个回答
0
投票

地址好像打错了,

loaclhost:8000
应该改成
localhost:8000

(浏览器正在尝试解析

loaclhost
,但不知道它指向什么ip地址)

© www.soinside.com 2019 - 2024. All rights reserved.