Merge branch 'master' into new_style

This commit is contained in:
mrfry 2021-03-06 14:54:49 +01:00
commit 843f0a7dad
6 changed files with 58 additions and 56 deletions

View file

@ -143,50 +143,50 @@ export default function Index({ globalData }) {
setNews(res.news)
})
}}
onReact={({ type, path, reaction, isDelete }) => {
if (type === 'news') {
fetch(constants.apiUrl + 'infos', {
method: 'POST',
credentials: 'include',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
react: reaction,
newsKey: key,
isDelete: isDelete,
}),
onNewsReact={({ reaction, isDelete }) => {
fetch(constants.apiUrl + 'react', {
method: 'POST',
credentials: 'include',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
reaction: reaction,
newsKey: key,
isDelete: isDelete,
}),
})
.then((res) => {
return res.json()
})
.then((res) => {
return res.json()
})
.then((res) => {
setNews(res.news)
})
} else if (type === 'comment') {
fetch(constants.apiUrl + 'comment', {
method: 'POST',
credentials: 'include',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
type: 'reaction',
newsKey: key,
path: path,
reaction: reaction,
isDelete: isDelete,
}),
.then((res) => {
console.log(res)
setNews(res.news)
})
}}
onCommentReact={({ path, reaction, isDelete }) => {
fetch(constants.apiUrl + 'react', {
method: 'POST',
credentials: 'include',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
type: 'reaction',
newsKey: key,
path: path,
reaction: reaction,
isDelete: isDelete,
}),
})
.then((res) => {
return res.json()
})
.then((res) => {
setNews(res.news)
})
.then((res) => {
return res.json()
})
.then((res) => {
setNews(res.news)
})
}
}}
onDelete={(path) => {
fetch(constants.apiUrl + 'comment', {