getRecommend.js
932 Bytes
function getRecommend(auth) {
console.log("login success", auth);
const host = 'http://localhost:23023';
const url = host+"/api/profile/recommend";
const data = { username: 'test' };
window.fetch(url, {
method: "POST",
body: JSON.stringify(data),
headers: {
'Content-Type': 'application/json'
}
})
.then(res => {
console.log(res);
return res.json();
})
.then(shareToKakao);
}
function shareToKakao({problem_number, problem_title, solved_date}) {
console.log('getting ready to share...');
const boj_link = "https://acmicpc.net/problem/" + problem_number.toString();
window.Kakao.Link.sendDefault({
objectType: 'text',
text: `오늘의 추천문제는 ${problem_title}`,
link: {
mobileWebUrl: boj_link,
webUrl: boj_link,
}
});
}
export {
getRecommend as default
};