Showing
6 changed files
with
40 additions
and
14 deletions
... | @@ -4,15 +4,6 @@ import styled from 'styled-components'; | ... | @@ -4,15 +4,6 @@ import styled from 'styled-components'; |
4 | import palette from '../../lib/styles/palette'; | 4 | import palette from '../../lib/styles/palette'; |
5 | import Button from '@material-ui/core/Button'; | 5 | import Button from '@material-ui/core/Button'; |
6 | import TextField from '@material-ui/core/TextField'; | 6 | import TextField from '@material-ui/core/TextField'; |
7 | -const BJIDFormBlock = styled.div` | ||
8 | - width: 100%; | ||
9 | - padding-top: 2rem; | ||
10 | - h4 { | ||
11 | - color: ${palette.gray[8]}; | ||
12 | - margin-top: 0; | ||
13 | - margin-bottom: 0.5rem; | ||
14 | - } | ||
15 | -`; | ||
16 | 7 | ||
17 | const useStyles = makeStyles((theme) => ({ | 8 | const useStyles = makeStyles((theme) => ({ |
18 | root: { | 9 | root: { |
... | @@ -32,7 +23,6 @@ const BJIDForm = ({ onChange, onBJIDSubmit, profile, onSyncBJIDSubmit }) => { | ... | @@ -32,7 +23,6 @@ const BJIDForm = ({ onChange, onBJIDSubmit, profile, onSyncBJIDSubmit }) => { |
32 | onChange={onChange} | 23 | onChange={onChange} |
33 | value={profile.userBJID} | 24 | value={profile.userBJID} |
34 | placeholder="백준 아이디" | 25 | placeholder="백준 아이디" |
35 | - id="standard-basic" | ||
36 | label="백준 아이디" | 26 | label="백준 아이디" |
37 | /> | 27 | /> |
38 | <Button variant="outlined" type="submit"> | 28 | <Button variant="outlined" type="submit"> | ... | ... |
... | @@ -2,19 +2,25 @@ import React, { useEffect, useState } from 'react'; | ... | @@ -2,19 +2,25 @@ import React, { useEffect, useState } from 'react'; |
2 | import { useDispatch, useSelector } from 'react-redux'; | 2 | import { useDispatch, useSelector } from 'react-redux'; |
3 | import { withRouter } from 'react-router-dom'; | 3 | import { withRouter } from 'react-router-dom'; |
4 | import HomeForm from '../../components/home/HomeForm'; | 4 | import HomeForm from '../../components/home/HomeForm'; |
5 | -const HomeContainer = ({ histroy }) => { | 5 | +import { getPROFILE } from '../../modules/profile'; |
6 | +import { analyzeBJ } from '../../lib/util/analyzeBJ'; | ||
7 | +const HomeContainer = ({ history }) => { | ||
6 | const dispatch = useDispatch(); | 8 | const dispatch = useDispatch(); |
7 | const [isLogin, setLogin] = useState(false); | 9 | const [isLogin, setLogin] = useState(false); |
8 | const { user, profile } = useSelector(({ user, profile }) => ({ | 10 | const { user, profile } = useSelector(({ user, profile }) => ({ |
9 | user: user.user, | 11 | user: user.user, |
10 | profile: profile, | 12 | profile: profile, |
11 | })); | 13 | })); |
12 | - | ||
13 | useEffect(() => { | 14 | useEffect(() => { |
14 | - if (user) { | 15 | + analyzeBJ(profile.solvedBJ); |
16 | + }, [profile.solvedBJ]); | ||
17 | + useEffect(() => { | ||
15 | setLogin(true); | 18 | setLogin(true); |
19 | + if (user) { | ||
20 | + let username = user.username; | ||
21 | + dispatch(getPROFILE({ username })); | ||
16 | } | 22 | } |
17 | - }); | 23 | + }, [dispatch, user]); |
18 | return <HomeForm />; | 24 | return <HomeForm />; |
19 | }; | 25 | }; |
20 | export default withRouter(HomeContainer); | 26 | export default withRouter(HomeContainer); | ... | ... |
... | @@ -5,5 +5,15 @@ | ... | @@ -5,5 +5,15 @@ |
5 | 4. 추천 문제 | 5 | 4. 추천 문제 |
6 | */ | 6 | */ |
7 | exports.analyzeBJ = function (solvedBJ) { | 7 | exports.analyzeBJ = function (solvedBJ) { |
8 | + console.log(typeof solvedBJ); | ||
9 | + if (solvedBJ) { | ||
10 | + solvedBJ.sort(function (a, b) { | ||
11 | + return a.solvedDate > b.solvedDate | ||
12 | + ? -1 | ||
13 | + : a.solvedDate < b.solvedDate | ||
14 | + ? 1 | ||
15 | + : 0; | ||
16 | + }); | ||
8 | console.log(solvedBJ); | 17 | console.log(solvedBJ); |
18 | + } | ||
9 | }; | 19 | }; | ... | ... |
jaksimsamil-page/src/lib/util/sendSlack.js
0 → 100644
1 | +const webhookUri = | ||
2 | + 'https://hooks.slack.com/services/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'; | ||
3 | + | ||
4 | +const slack = new Slack(); | ||
5 | +slack.setWebhook(webhookUri); | ||
6 | +const send = async (message) => { | ||
7 | + slack.webhook( | ||
8 | + { | ||
9 | + channel: '#general', // 전송될 슬랙 채널 | ||
10 | + username: 'webhookbot', //슬랙에 표시될 이름 | ||
11 | + text: message, | ||
12 | + }, | ||
13 | + function (err, response) { | ||
14 | + console.log(response); | ||
15 | + }, | ||
16 | + ); | ||
17 | +}; | ||
18 | + | ||
19 | +send('안녕'); |
This diff is collapsed. Click to expand it.
... | @@ -22,6 +22,7 @@ | ... | @@ -22,6 +22,7 @@ |
22 | "mongoose": "^5.9.17", | 22 | "mongoose": "^5.9.17", |
23 | "morgan": "^1.10.0", | 23 | "morgan": "^1.10.0", |
24 | "path": "^0.12.7", | 24 | "path": "^0.12.7", |
25 | + "slack-node": "^0.1.8", | ||
25 | "voca": "^1.4.0" | 26 | "voca": "^1.4.0" |
26 | }, | 27 | }, |
27 | "devDependencies": { | 28 | "devDependencies": { | ... | ... |
-
Please register or login to post a comment