Skip to content

Commit 2bbce51

Browse files
committed
prettier
1 parent 67962af commit 2bbce51

File tree

6 files changed

+24
-35
lines changed

6 files changed

+24
-35
lines changed

.sequelizerc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var path = require('path')
22

33
module.exports = {
4-
'config': path.resolve('config.js'),
4+
'config': path.resolve(path.join('front', 'config.js')),
55
}

front/DeleteButton.tsx

+5-8
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,11 @@ const DeleteButton = ({ commentId }) => {
1212
query: { pid },
1313
} = router
1414
const handleDelete = async (commentId) => {
15-
await axios.delete(
16-
`${apiPath}/articles/${pid}/comments/${commentId}`,
17-
{
18-
headers: {
19-
Authorization: `Token ${loggedInUser?.token}`,
20-
},
21-
}
22-
)
15+
await axios.delete(`${apiPath}/articles/${pid}/comments/${commentId}`, {
16+
headers: {
17+
Authorization: `Token ${loggedInUser?.token}`,
18+
},
19+
})
2320
trigger(`${apiPath}/articles/${pid}/comments`)
2421
}
2522

front/FavoriteArticleButton.tsx

+5-8
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,11 @@ const FavoriteArticleButton = (props) => {
3434
setFavoritesCount((prev) => prev + (favorited ? -1 : 1))
3535
try {
3636
if (favorited) {
37-
await axios.delete(
38-
`${apiPath}/articles/${props.slug}/favorite`,
39-
{
40-
headers: {
41-
Authorization: `Token ${loggedInUser?.token}`,
42-
},
43-
}
44-
)
37+
await axios.delete(`${apiPath}/articles/${props.slug}/favorite`, {
38+
headers: {
39+
Authorization: `Token ${loggedInUser?.token}`,
40+
},
41+
})
4542
} else {
4643
await axios.post(
4744
`${apiPath}/articles/${props.slug}/favorite`,

front/Tags.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ import { apiPath } from 'front/config'
66
import ErrorMessage from 'front/ErrorMessage'
77

88
const Tags = ({ tags, ssr, setTab, setPage, setTag }) => {
9-
const { data, error } = useSWR(
10-
ssr ? null : `${apiPath}/tags`,
11-
fetcher()
12-
)
9+
const { data, error } = useSWR(ssr ? null : `${apiPath}/tags`, fetcher())
1310
if (error) return <ErrorMessage message="Cannot load popular tags..." />
1411
if (data) {
1512
;({ tags } = data)

front/api/article.ts

+11-12
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ const ArticleAPI = {
1111

1212
byAuthor: (author, page = 0, limit = 5) =>
1313
axios.get(
14-
`${apiPath}/articles?author=${encodeURIComponent(
15-
author
16-
)}&${getQuery(limit, page)}`
14+
`${apiPath}/articles?author=${encodeURIComponent(author)}&${getQuery(
15+
limit,
16+
page
17+
)}`
1718
),
1819

1920
byTag: (tag, page = 0, limit = 10) =>
@@ -31,24 +32,22 @@ const ArticleAPI = {
3132
},
3233
}),
3334

34-
favorite: (slug) =>
35-
axios.post(`${apiPath}/articles/${slug}/favorite`),
35+
favorite: (slug) => axios.post(`${apiPath}/articles/${slug}/favorite`),
3636

3737
favoritedBy: (author, page) =>
3838
axios.get(
39-
`${apiPath}/articles?favorited=${encodeURIComponent(
40-
author
41-
)}&${getQuery(10, page)}`
39+
`${apiPath}/articles?favorited=${encodeURIComponent(author)}&${getQuery(
40+
10,
41+
page
42+
)}`
4243
),
4344

4445
feed: (page, limit = 10) =>
4546
axios.get(`${apiPath}/articles/feed?${getQuery(limit, page)}`),
4647

47-
get: (slug) =>
48-
axios.get(`${apiPath}/articles/${encodeURIComponent(slug)}`),
48+
get: (slug) => axios.get(`${apiPath}/articles/${encodeURIComponent(slug)}`),
4949

50-
unfavorite: (slug) =>
51-
axios.delete(`${apiPath}/articles/${slug}/favorite`),
50+
unfavorite: (slug) => axios.delete(`${apiPath}/articles/${slug}/favorite`),
5251

5352
update: async (article, pid, token) => {
5453
const { data, status } = await axios.put(

front/api/comment.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ const CommentAPI = {
2525
}
2626
},
2727

28-
forArticle: (slug) =>
29-
axios.get(`${apiPath}/articles/${slug}/comments`),
28+
forArticle: (slug) => axios.get(`${apiPath}/articles/${slug}/comments`),
3029
}
3130

3231
export default CommentAPI

0 commit comments

Comments
 (0)