redbean096@khu.ac.kr

delete unecessary code and module

This diff is collapsed. Click to expand it.
......@@ -3,7 +3,7 @@ import { makeStyles } from '@material-ui/core/styles';
import Paper from '@material-ui/core/Paper';
import Grid from '@material-ui/core/Grid';
import palette from '../../lib/styles/palette';
import AuthForm from '../auth/AuthForm';
const useStyles = makeStyles((theme) => ({
root: {
flexGrow: 1,
......
import React from 'react';
import getRecommend from "../../scripts/getRecommend";
const KakaoLoginBtn = () => {
const KakaoLogin = function () {
window.Kakao.Auth.login({
success: getRecommend,
fail: function (err) {
console.log("login failed", err);
}
})
}
return (
<div>
<button onClick={KakaoLogin}
a id="custom-login-btn" href="javascript:loginWithKakao()">
<img
src="//k.kakaocdn.net/14/dn/btqCn0WEmI3/nijroPfbpCa4at5EIsjyf0/o.jpg"
width="140"
/>
</button>
</div>
);
};
export default KakaoLoginBtn
\ No newline at end of file
......@@ -75,7 +75,7 @@ const SettingContainer = ({ history }) => {
}
}, [dispatch, user, history]);
useEffect(() => {
if (loading['profile/SYNC_BJID'] == true) {
if (loading['profile/SYNC_BJID']) {
setLoading(true);
} else {
setLoading(false);
......
......@@ -9,8 +9,3 @@ export const register = ({ username, password }) =>
export const check = () => client.get('api/auth/check');
export const logout = () => client.post('/api/auth/logout');
export const kakaotoken = (kakaotoken) =>
client.post('api/auth/kakaotoken', {
kakaotoken: kakaotoken
});
......
const app = require('koa')
function getRecommend(auth) {
console.log("login success", auth);
const host = 'https://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);
}
const TOKEN = 'tdN03DyXDAcKGZsuiPndaU7UC2GzuEQYUhPCkDnGWXGGdiPmV15QYbFU1U5JP5EpiETIKLqOmci/RxFZTfD7FRMED0OpT+3qgEYBNf8T9/jRzHRm7rblBLtzFBVOeXeYRcluOsz4koE4JaAJaUtMtwdB04t89/1O/w1cDnyilFU='
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.fetch('https://www.osstest17.ml:23023/hook', {
method: "POST",
body: JSON.stringify(data),
headers: {
'Authorization': `Bearer ${TOKEN}`
},
json: {
"replyToken":eventObj.replyToken,
"messages":[
{
"type":"text",
"text":"Hello, user"
},
{
"type":"text",
"text":"May I help you?"
}
]
}
})
window.Kakao.Link.sendDefault({
objectType: 'text',
text: `오늘의 추천문제는 ${problem_title}`,
link: {
mobileWebUrl: boj_link,
webUrl: boj_link,
}
});
}
export {
getRecommend as default
};
\ No newline at end of file