For the first time, the front and back ends are separated with vue, and the POST request cannot receive data.

now you are doing the function of creating a new account

clipboard.png

post:


clipboard.png

I"ve been debugging all afternoon, but I still don"t know what the problem is. Cry ~


axios needs to add its own configuration using post request

use qs as a class library

import qs from 'qs';
axios.interceptors.request.use( (config) => {
    if (config.method=="post"){
        config.data = qs.stringify(config.data);
        config.headers['Content-Type'] = 'application/x-www-form-urlencoded';
    }
    return config;
},  (error) => {
    return Promise.reject(error);
});

write an api.js, creation interface, such as export const addUser = params = > {return axios.post ( ${base} / _ / api/v1/user , params). Then (res = > res.data);
then import it with import on the page, and then use ~


the backend requires you to put the parameters into url , and your post data is put into body, of course. You can do this by configuring post's config .


is there another status parameter?


axios.post('/account/add',{
    headers: {
        Authorization : getCookie('token')
    },
    params:{
        name:this.name,
        email:this.email,
        password:this.password,
        status:1,
        roleId:this.role  
    }
})

am I right to change to this?


what management interface does the back end of your company use?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eae063-21a7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eae063-21a7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?