개발중/Vue.js

vue post (insert )

Binsoo 2021. 6. 14. 10:03
728x90
반응형

vue 에서 insert 할 때는 FormData 를 생성해서 데이터를 실어 보내줘야 한다.

 

이유는 post 를 할 때에는 headers - ContentType 이 'application/x-www-form-urlencoded' 이기 때문이다.

 

더보기
export function insertLearning(data){

    const frm = new FormData()

	frm.append('mmtSeq', data.mmtSeq)
	frm.append('tdiSeq', data.tdiSeq)
	frm.append('mmiName', data.mmiName)

	return request({
		url: '/api/machine-learning',
		method: 'post',
		headers: {'Content-Type': 'application/x-www-form-urlencoded'},
        data : frm
	})
    
}

 

728x90
반응형