Showing
6 changed files
with
29 additions
and
29 deletions
... | @@ -20,7 +20,7 @@ spec: | ... | @@ -20,7 +20,7 @@ spec: |
20 | spec: | 20 | spec: |
21 | containers: | 21 | containers: |
22 | - name: backend | 22 | - name: backend |
23 | - image: khujay15/backend:1.1 | 23 | + image: khujay15/backend:1.2 |
24 | ports: | 24 | ports: |
25 | - containerPort: 5000 | 25 | - containerPort: 5000 |
26 | name: backend | 26 | name: backend | ... | ... |
... | @@ -9,7 +9,7 @@ export default function ArticlePage() { | ... | @@ -9,7 +9,7 @@ export default function ArticlePage() { |
9 | const { query } = useRouter(); | 9 | const { query } = useRouter(); |
10 | 10 | ||
11 | if (!query.num) { | 11 | if (!query.num) { |
12 | - return null; // or redirect 404 ? | 12 | + return <div>error!</div> |
13 | } | 13 | } |
14 | 14 | ||
15 | const { error, data } = useQuery(GET_POST_WITH_COMMENTS, { | 15 | const { error, data } = useQuery(GET_POST_WITH_COMMENTS, { | ... | ... |
project/packages/web/pages/[name]/index.tsx
0 → 100644
1 | +export { default } from './article'; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | -import { useRouter } from 'next/router'; | 1 | +export { default } from './index'; |
2 | -import { useQuery } from '@apollo/client'; | ||
3 | - | ||
4 | -import { GET_SOME_POSTS } from '@src/gql/get-some-posts'; | ||
5 | - | ||
6 | -import Category from '@src/views/Category'; | ||
7 | - | ||
8 | -export default function CategoryPage() { | ||
9 | - const { | ||
10 | - query: { name }, | ||
11 | - } = useRouter(); | ||
12 | - | ||
13 | - const { error, data } = useQuery(GET_SOME_POSTS, { | ||
14 | - variables: { | ||
15 | - input: { category: name }, | ||
16 | - }, | ||
17 | - }); | ||
18 | - | ||
19 | - if (error) console.log(JSON.stringify(error, null, 2)); | ||
20 | - | ||
21 | - const getCategoryPosts = data?.getSomePosts || []; | ||
22 | - const articleList = getCategoryPosts.filter((post) => post.category === name); | ||
23 | - | ||
24 | - return <Category category={name} articleList={articleList} />; | ||
25 | -} | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | +import { useRouter } from 'next/router'; | ||
2 | +import { useQuery } from '@apollo/client'; | ||
3 | + | ||
4 | +import { GET_SOME_POSTS } from '@src/gql/get-some-posts'; | ||
5 | + | ||
6 | +import Category from '@src/views/Category'; | ||
7 | + | ||
8 | +export default function CategoryPage() { | ||
9 | + const { | ||
10 | + query: { name }, | ||
11 | + } = useRouter(); | ||
12 | + | ||
13 | + const { error, data } = useQuery(GET_SOME_POSTS, { | ||
14 | + variables: { | ||
15 | + input: { category: name }, | ||
16 | + }, | ||
17 | + }); | ||
18 | + | ||
19 | + if (error) console.log(JSON.stringify(error, null, 2)); | ||
20 | + | ||
21 | + const getCategoryPosts = data?.getSomePosts || []; | ||
22 | + const articleList = getCategoryPosts.filter((post) => post.category === name); | ||
23 | + | ||
24 | + return <Category category={name} articleList={articleList} />; | ||
25 | +} |
... | @@ -3,9 +3,7 @@ import { Card, Descriptions } from 'antd'; | ... | @@ -3,9 +3,7 @@ import { Card, Descriptions } from 'antd'; |
3 | import moment from 'moment'; | 3 | import moment from 'moment'; |
4 | 4 | ||
5 | export default function Content({ | 5 | export default function Content({ |
6 | - id, | ||
7 | author, | 6 | author, |
8 | - category, | ||
9 | created_date, | 7 | created_date, |
10 | title, | 8 | title, |
11 | content, | 9 | content, | ... | ... |
-
Please register or login to post a comment