linhbui-gif / kingstudy-website-v2

0 stars 0 forks source link

kingstudy_integrate-api-submit-studyaboard #123

Open linhbui-gif opened 3 months ago

linhbui-gif commented 3 months ago

1, vào http://localhost:3000/profile?page=my-profile

2, CHọn tab thông tin du học

3, Chọn cập nhật ngay

4, Ghép api cho form step

Note : Đã tạo sẵn api ở service/profile/index.js hàm submitProfileStudyAboard chỉ việc call ra là được

5, CURL Api : Dùng để biết có những tham số nào truyền lên hoặc method là gì, Tạm thời chỉ có mấy thông tin như ở dưới vẫn đang thiếu so với UI nhé

// WARNING: For POST requests, body is set to null by browsers. var data = new FormData(); data.append("job_salary", "10000"); data.append("birth_day", "2024-10-04"); data.append("identity_card_date", "2024-10-04"); data.append("identity_card_expiration_date", "2024-10-04"); data.append("passport_date", "2024-10-04"); data.append("father_birth_day", "2024-10-04");

var xhr = new XMLHttpRequest(); xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() { if(this.readyState === 4) { console.log(this.responseText); } });

xhr.open("POST", "https://king-study.loc/api/v1/profile/update-information-study-aboard"); xhr.setRequestHeader("Authorization", "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2tpbmctc3R1ZHkubG9jL2FwaS92MS9hdXRoL2xvZ2luIiwiaWF0IjoxNzE3OTQ1NDM2LCJleHAiOjE3MTkxNTUwMzYsIm5iZiI6MTcxNzk0NTQzNiwianRpIjoiNm9yQ1dZN091a2pvcEpWZyIsInN1YiI6IjI5NyIsInBydiI6IjIzYmQ1Yzg5NDlmNjAwYWRiMzllNzAxYzQwMDg3MmRiN2E1OTc2ZjcifQ.I_xq9zZmXtnVrwQK-Fa2IXV_rm0c-VIfXWJ5eGSMGvE"); // WARNING: Cookies will be stripped away by the browser before sending the request. xhr.setRequestHeader("Cookie", "compare_list=28%2C123%2C100");

xhr.send(data);

quocdat16061990 commented 3 months ago

https://github.com/linhbui-gif/kingstudy-website-v2/pull/125/commits/9f90536ff67df1686b86e050ff93c46b548d4c3b

quocdat16061990 commented 3 months ago

https://github.com/linhbui-gif/kingstudy-website-v2/pull/125/commits