How do I change jquery ajaxForm to axios?
Now the following ajaxForm exists.
$("#ccForm").ajaxForm({
url: '/api/cc/registCcInfo',
type: 'post',
dataType: 'json',
beforeSend: function (xhr) {
xhr.setRequestHeader("Authorization", `Bearer ` + getCookie("deviceToken"));
},
success: function (response) {
response.status = 200;
response.data = {};
response.data.resultCd = response.resultCd;
response.data.resultMsg = response.resultMsg;
modal.querySelector("button.close").click();
formData looks like this:
{
"ccNo": "",
"ccName": "aa",
"ccAddress": "",
"ccTel": "",
"ccX": "",
"ccY": "",
"perPage": 10,
"file": File
lastModified: 1642483829515
lastModifiedDate: Tue Jan 18 2022 14:30:29 GMT+0900 (Korean Standard Time) {}
name: "3683.jpg"
size: 195096
type: "image/jpeg"
webkitRelativePath: ""
[[Prototype]]: File
}
I want to change this data to axios at once. I can't figure out how the input type passes both text as well as file .