Showing
12 changed files
with
8 additions
and
79 deletions
... | @@ -15,9 +15,7 @@ export const login = async (email, password) => { | ... | @@ -15,9 +15,7 @@ export const login = async (email, password) => { |
15 | if (response == undefined || (response.status !== 200 && response.status !== 201)) { | 15 | if (response == undefined || (response.status !== 200 && response.status !== 201)) { |
16 | throw alert('Login failed!'); | 16 | throw alert('Login failed!'); |
17 | } | 17 | } |
18 | - console.log(response.data.access_token) | ||
19 | useSession.accessToken = response.data.access_token; | 18 | useSession.accessToken = response.data.access_token; |
20 | - console.log("로그인" + useSession.accessToken); | ||
21 | return response.data; | 19 | return response.data; |
22 | } | 20 | } |
23 | 21 | ||
... | @@ -65,7 +63,6 @@ export const refreshToken = async () => { | ... | @@ -65,7 +63,6 @@ export const refreshToken = async () => { |
65 | } | 63 | } |
66 | 64 | ||
67 | export const validateToken = async () => { | 65 | export const validateToken = async () => { |
68 | - console.log(useSession.accessToken); | ||
69 | if(useSession.accessToken == undefined){ | 66 | if(useSession.accessToken == undefined){ |
70 | return false; | 67 | return false; |
71 | } | 68 | } | ... | ... |
... | @@ -55,7 +55,6 @@ export const getPostsByDifficulty = async (difficulty) => { | ... | @@ -55,7 +55,6 @@ export const getPostsByDifficulty = async (difficulty) => { |
55 | if (response.status !== 200) { | 55 | if (response.status !== 200) { |
56 | throw new Error('Failed to get posts!'); | 56 | throw new Error('Failed to get posts!'); |
57 | } | 57 | } |
58 | - console.log(response.data); | ||
59 | return response.data; | 58 | return response.data; |
60 | } | 59 | } |
61 | 60 | ... | ... |
... | @@ -3,9 +3,6 @@ import router from "next/router" | ... | @@ -3,9 +3,6 @@ import router from "next/router" |
3 | import { Button } from "semantic-ui-react" | 3 | import { Button } from "semantic-ui-react" |
4 | 4 | ||
5 | export default function Nav() { | 5 | export default function Nav() { |
6 | - const moverun = () => { | ||
7 | - router.push("/run") | ||
8 | - } | ||
9 | 6 | ||
10 | const movenew = () => { | 7 | const movenew = () => { |
11 | router.push("/new") | 8 | router.push("/new") |
... | @@ -24,9 +21,6 @@ export default function Nav() { | ... | @@ -24,9 +21,6 @@ export default function Nav() { |
24 | <nav className="navbar"> | 21 | <nav className="navbar"> |
25 | <div className="flex px-10 sm:px-20 text-2xl whitespace-nowrap | 22 | <div className="flex px-10 sm:px-20 text-2xl whitespace-nowrap |
26 | space-x-10 sm:space-x-20"> | 23 | space-x-10 sm:space-x-20"> |
27 | - <Button onClick={moverun} className="cursor-pointer transition | ||
28 | - duration-100 transform hover:scale-125 hover:text-black | ||
29 | - active:text-white">테스트</Button> | ||
30 | <Button onClick={movelow} className="cursor-pointer transition | 24 | <Button onClick={movelow} className="cursor-pointer transition |
31 | duration-100 transform hover:scale-125 hover:text-black | 25 | duration-100 transform hover:scale-125 hover:text-black |
32 | active:text-white">난이도 하</Button> | 26 | active:text-white">난이도 하</Button> | ... | ... |
... | @@ -12,7 +12,6 @@ export default function Popular() { | ... | @@ -12,7 +12,6 @@ export default function Popular() { |
12 | }, []); | 12 | }, []); |
13 | 13 | ||
14 | const DateType = (date) => { | 14 | const DateType = (date) => { |
15 | - console.log(date); | ||
16 | const dateObj = new Date(date); | 15 | const dateObj = new Date(date); |
17 | const month = dateObj.toLocaleString("default", { month: "long" }); | 16 | const month = dateObj.toLocaleString("default", { month: "long" }); |
18 | const day = dateObj.getDate(); | 17 | const day = dateObj.getDate(); | ... | ... |
... | @@ -12,7 +12,6 @@ export default function Popular() { | ... | @@ -12,7 +12,6 @@ export default function Popular() { |
12 | }, []); | 12 | }, []); |
13 | 13 | ||
14 | const DateType = (date) => { | 14 | const DateType = (date) => { |
15 | - console.log(date); | ||
16 | const dateObj = new Date(date); | 15 | const dateObj = new Date(date); |
17 | const month = dateObj.toLocaleString("default", { month: "long" }); | 16 | const month = dateObj.toLocaleString("default", { month: "long" }); |
18 | const day = dateObj.getDate(); | 17 | const day = dateObj.getDate(); | ... | ... |
... | @@ -12,7 +12,6 @@ export default function Popular() { | ... | @@ -12,7 +12,6 @@ export default function Popular() { |
12 | }, []); | 12 | }, []); |
13 | 13 | ||
14 | const DateType = (date) => { | 14 | const DateType = (date) => { |
15 | - console.log(date); | ||
16 | const dateObj = new Date(date); | 15 | const dateObj = new Date(date); |
17 | const month = dateObj.toLocaleString("default", { month: "long" }); | 16 | const month = dateObj.toLocaleString("default", { month: "long" }); |
18 | const day = dateObj.getDate(); | 17 | const day = dateObj.getDate(); | ... | ... |
... | @@ -12,7 +12,6 @@ export default function Popular() { | ... | @@ -12,7 +12,6 @@ export default function Popular() { |
12 | }, []); | 12 | }, []); |
13 | 13 | ||
14 | const DateType = (date) => { | 14 | const DateType = (date) => { |
15 | - console.log(date); | ||
16 | const dateObj = new Date(date); | 15 | const dateObj = new Date(date); |
17 | const month = dateObj.toLocaleString("default", { month: "long" }); | 16 | const month = dateObj.toLocaleString("default", { month: "long" }); |
18 | const day = dateObj.getDate(); | 17 | const day = dateObj.getDate(); | ... | ... |
... | @@ -32,7 +32,6 @@ export default function New() { | ... | @@ -32,7 +32,6 @@ export default function New() { |
32 | const testoutput = form.testoutput.value.split("\n"); | 32 | const testoutput = form.testoutput.value.split("\n"); |
33 | const difficulty = form.level.value; | 33 | const difficulty = form.level.value; |
34 | const post = await newPost(title, explain, example, testinput, testoutput, difficulty); | 34 | const post = await newPost(title, explain, example, testinput, testoutput, difficulty); |
35 | - console.log(post); | ||
36 | router.push("/"); | 35 | router.push("/"); |
37 | }; | 36 | }; |
38 | return ( | 37 | return ( | ... | ... |
... | @@ -22,7 +22,6 @@ export default function Post() { | ... | @@ -22,7 +22,6 @@ export default function Post() { |
22 | if (!router.isReady) return; | 22 | if (!router.isReady) return; |
23 | const { id } = router.query | 23 | const { id } = router.query |
24 | getPostbyId(id).then(res => { | 24 | getPostbyId(id).then(res => { |
25 | - console.log(res); | ||
26 | setPost(res) | 25 | setPost(res) |
27 | }) | 26 | }) |
28 | }, [router.isReady]); | 27 | }, [router.isReady]); |
... | @@ -36,13 +35,14 @@ export default function Post() { | ... | @@ -36,13 +35,14 @@ export default function Post() { |
36 | const [comment, setComment] = useState(""); | 35 | const [comment, setComment] = useState(""); |
37 | 36 | ||
38 | const addComment = async () => { | 37 | const addComment = async () => { |
39 | - console.log("comment is " + comment); | ||
40 | const { id } = router.query | 38 | const { id } = router.query |
41 | - await createComment(id, comment) | 39 | + await createComment(id, comment); |
40 | + getPostbyId(id).then(res => { | ||
41 | + setPost(res) | ||
42 | + }) | ||
42 | } | 43 | } |
43 | 44 | ||
44 | const displayComment = () => { | 45 | const displayComment = () => { |
45 | - console.log(post.comments); | ||
46 | if (post.comments != undefined) { | 46 | if (post.comments != undefined) { |
47 | return post.comments.map(comment => ( | 47 | return post.comments.map(comment => ( |
48 | <div className="flex w-full border-carbon border-4 rounded-xl my-2"> | 48 | <div className="flex w-full border-carbon border-4 rounded-xl my-2"> |
... | @@ -66,15 +66,12 @@ export default function Post() { | ... | @@ -66,15 +66,12 @@ export default function Post() { |
66 | return; | 66 | return; |
67 | } | 67 | } |
68 | var result = await run(code, value); | 68 | var result = await run(code, value); |
69 | - console.log(result); | ||
70 | setAnswer(`출력 : ${result}`); | 69 | setAnswer(`출력 : ${result}`); |
71 | } | 70 | } |
72 | 71 | ||
73 | const testinput = () => { | 72 | const testinput = () => { |
74 | const insert = post.testinput; | 73 | const insert = post.testinput; |
75 | - console.log("insert = " + insert); | ||
76 | if (insert === [""] || insert === undefined) { | 74 | if (insert === [""] || insert === undefined) { |
77 | - console.log("없음"); | ||
78 | return <div></div> | 75 | return <div></div> |
79 | } | 76 | } |
80 | return <div> | 77 | return <div> |
... | @@ -87,9 +84,7 @@ export default function Post() { | ... | @@ -87,9 +84,7 @@ export default function Post() { |
87 | 84 | ||
88 | const testoutput = () => { | 85 | const testoutput = () => { |
89 | const insert = post.testoutput; | 86 | const insert = post.testoutput; |
90 | - console.log("insert = " + insert); | ||
91 | if (insert === [""] || insert === undefined) { | 87 | if (insert === [""] || insert === undefined) { |
92 | - console.log("없음"); | ||
93 | return <div></div> | 88 | return <div></div> |
94 | } | 89 | } |
95 | return <div> | 90 | return <div> | ... | ... |
src/pages/run.js
deleted
100755 → 0
1 | -import "@uiw/react-textarea-code-editor/dist.css"; | ||
2 | -import dynamic from "next/dynamic"; | ||
3 | -import { useState } from "react"; | ||
4 | -import { Button } from "semantic-ui-react"; | ||
5 | -import { run } from "../api/runner/runner"; | ||
6 | -import { useRouter } from "next/dist/client/router"; | ||
7 | - | ||
8 | -const CodeEditor = dynamic( | ||
9 | - () => import("@uiw/react-textarea-code-editor").then((mod) => mod.default), | ||
10 | - { ssr: false } | ||
11 | -); | ||
12 | - | ||
13 | -export default function Run() { | ||
14 | - const router = useRouter(); | ||
15 | - | ||
16 | - const [value, setValue] = useState("c"); | ||
17 | - | ||
18 | - const [code, setCode] = useState(""); | ||
19 | - | ||
20 | - const [answer, setAnswer] = useState(""); | ||
21 | - | ||
22 | - const runCode = async function () { | ||
23 | - var result = await run(code, value); | ||
24 | - console.log(result); | ||
25 | - setAnswer(result); | ||
26 | - } | ||
27 | - | ||
28 | - return (<div> | ||
29 | - <select value={value} onChange={(e) => setValue(e.target.value)}> | ||
30 | - <option value="c">c</option> | ||
31 | - <option value="cpp">cpp</option> | ||
32 | - <option value="js">javascript</option> | ||
33 | - </select> | ||
34 | - <CodeEditor | ||
35 | - value={code} | ||
36 | - language={value} | ||
37 | - placeholder="Please Enter the Code." | ||
38 | - onChange={(e) => setCode(e.target.value)} | ||
39 | - padding={15} | ||
40 | - style={{ | ||
41 | - fontSize: 12, | ||
42 | - backgroundColor: "#f5f5f5", | ||
43 | - fontFamily: | ||
44 | - "ui-monospace,SFMono-Regular,SF Mono,Consolas,Liberation Mono,Menlo,monospace" | ||
45 | - }} | ||
46 | - /> | ||
47 | - <Button onClick={runCode}>Run</Button> | ||
48 | - <div>{answer}</div> | ||
49 | - </div>); | ||
50 | -} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | import { searchPost } from "../api/post/post"; | 1 | import { searchPost } from "../api/post/post"; |
2 | import { useState } from "react"; | 2 | import { useState } from "react"; |
3 | import { SearchIcon } from "@heroicons/react/outline"; | 3 | import { SearchIcon } from "@heroicons/react/outline"; |
4 | +import { Link } from "@nextui-org/react"; | ||
4 | 5 | ||
5 | export default function Search() { | 6 | export default function Search() { |
6 | const handleSubmit = async (e) => { | 7 | const handleSubmit = async (e) => { |
7 | e.preventDefault(); | 8 | e.preventDefault(); |
8 | const search = await searchPost(e.target.search.value); | 9 | const search = await searchPost(e.target.search.value); |
9 | - console.log(search) | ||
10 | setResult(search); | 10 | setResult(search); |
11 | } | 11 | } |
12 | 12 | ||
... | @@ -24,9 +24,9 @@ export default function Search() { | ... | @@ -24,9 +24,9 @@ export default function Search() { |
24 | <h1 className="text-2xl font-bold">Search Result</h1> | 24 | <h1 className="text-2xl font-bold">Search Result</h1> |
25 | {result.map((post) => { | 25 | {result.map((post) => { |
26 | return ( | 26 | return ( |
27 | - <div> | 27 | + <Link href={`/post/${post.id}`}> |
28 | - <h2>{post.title}</h2> | 28 | + <h2 className="text-xl">{post.title}</h2> |
29 | - </div> | 29 | + </Link> |
30 | ) | 30 | ) |
31 | })} | 31 | })} |
32 | </div> | 32 | </div> | ... | ... |
... | @@ -32,7 +32,6 @@ export default function Signup() { | ... | @@ -32,7 +32,6 @@ export default function Signup() { |
32 | const email = form.email.value; | 32 | const email = form.email.value; |
33 | const password = form.password.value; | 33 | const password = form.password.value; |
34 | const passwordConfirm = form.passwordConfirm.value; | 34 | const passwordConfirm = form.passwordConfirm.value; |
35 | - console.log(name, email, password, passwordConfirm); | ||
36 | if (password !== passwordConfirm) { | 35 | if (password !== passwordConfirm) { |
37 | alert("Passwords do not match"); | 36 | alert("Passwords do not match"); |
38 | return; | 37 | return; | ... | ... |
-
Please register or login to post a comment