redbean096@khu.ac.kr

Merge branch 'kakaoDev' of http://khuhub.khu.ac.kr/2020-2_open_source_sw_develop…

…ment_Han/Jaksimsamil into lineDev
1 +import React from 'react';
2 +
3 +const LineQR = () => {
4 + return (
5 + <div>
6 + <img
7 + src="https://qr-official.line.me/sid/L/215xiena.png"
8 + width="130"
9 + />
10 + </div>
11 + );
12 +};
13 +
14 +export default LineQR
...\ No newline at end of file ...\ No newline at end of file
...@@ -8,7 +8,7 @@ import Paper from '@material-ui/core/Paper'; ...@@ -8,7 +8,7 @@ import Paper from '@material-ui/core/Paper';
8 import Grid from '@material-ui/core/Grid'; 8 import Grid from '@material-ui/core/Grid';
9 import CircularProgress from '@material-ui/core/CircularProgress'; 9 import CircularProgress from '@material-ui/core/CircularProgress';
10 import styled from 'styled-components'; 10 import styled from 'styled-components';
11 -import KakaoLoginBtn from './KakaoLogin' 11 +import LineQR from './LineQR'
12 12
13 const useStyles = makeStyles((theme) => ({ 13 const useStyles = makeStyles((theme) => ({
14 root: { 14 root: {
...@@ -84,11 +84,8 @@ const SettingForm = ({ ...@@ -84,11 +84,8 @@ const SettingForm = ({
84 84
85 <Grid container item xs={6}> 85 <Grid container item xs={6}>
86 <Paper className={classes.paper} elevation={3}> 86 <Paper className={classes.paper} elevation={3}>
87 - <h1>카카오 로그인</h1> 87 + <h1>QR코드를 찍어주세요</h1>
88 - <KakaoLoginBtn 88 + <LineQR></LineQR>
89 - profile={profile}
90 - onChange={onChange}
91 - />
92 </Paper> 89 </Paper>
93 </Grid> 90 </Grid>
94 91
......
1 +const app = require('koa')
1 function getRecommend(auth) { 2 function getRecommend(auth) {
2 console.log("login success", auth); 3 console.log("login success", auth);
3 - const host = 'http://localhost:23023'; 4 + const host = 'https://localhost:23023';
4 const url = host+"/api/profile/recommend"; 5 const url = host+"/api/profile/recommend";
6 +
5 const data = { username: 'test' }; 7 const data = { username: 'test' };
6 window.fetch(url, { 8 window.fetch(url, {
7 method: "POST", 9 method: "POST",
...@@ -16,10 +18,31 @@ function getRecommend(auth) { ...@@ -16,10 +18,31 @@ function getRecommend(auth) {
16 }) 18 })
17 .then(shareToKakao); 19 .then(shareToKakao);
18 } 20 }
21 +const TOKEN = 'tdN03DyXDAcKGZsuiPndaU7UC2GzuEQYUhPCkDnGWXGGdiPmV15QYbFU1U5JP5EpiETIKLqOmci/RxFZTfD7FRMED0OpT+3qgEYBNf8T9/jRzHRm7rblBLtzFBVOeXeYRcluOsz4koE4JaAJaUtMtwdB04t89/1O/w1cDnyilFU='
19 22
20 function shareToKakao({problem_number, problem_title, solved_date}) { 23 function shareToKakao({problem_number, problem_title, solved_date}) {
21 console.log('getting ready to share...'); 24 console.log('getting ready to share...');
22 const boj_link = "https://acmicpc.net/problem/" + problem_number.toString(); 25 const boj_link = "https://acmicpc.net/problem/" + problem_number.toString();
26 + window.fetch('https://www.osstest17.ml:23023/hook', {
27 + method: "POST",
28 + body: JSON.stringify(data),
29 + headers: {
30 + 'Authorization': `Bearer ${TOKEN}`
31 + },
32 + json: {
33 + "replyToken":eventObj.replyToken,
34 + "messages":[
35 + {
36 + "type":"text",
37 + "text":"Hello, user"
38 + },
39 + {
40 + "type":"text",
41 + "text":"May I help you?"
42 + }
43 + ]
44 + }
45 + })
23 window.Kakao.Link.sendDefault({ 46 window.Kakao.Link.sendDefault({
24 objectType: 'text', 47 objectType: 'text',
25 text: `오늘의 추천문제는 ${problem_title}`, 48 text: `오늘의 추천문제는 ${problem_title}`,
...@@ -29,7 +52,6 @@ function shareToKakao({problem_number, problem_title, solved_date}) { ...@@ -29,7 +52,6 @@ function shareToKakao({problem_number, problem_title, solved_date}) {
29 } 52 }
30 }); 53 });
31 } 54 }
32 -
33 export { 55 export {
34 getRecommend as default 56 getRecommend as default
35 }; 57 };
...\ No newline at end of file ...\ No newline at end of file
......