最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

网站源码admin40浏览0评论

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

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

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);
    });
};
回答如下:

地址好像打错了,

loaclhost:8000
应该改成
localhost:8000

(浏览器正在尝试解析

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

发布评论

评论列表(0)

  1. 暂无评论