mirror of
https://gitlab.com/MrFry/qmining-page
synced 2025-04-01 20:23:44 +02:00
Changed api endpoints
This commit is contained in:
parent
d84948918f
commit
b2034089cd
4 changed files with 48 additions and 47 deletions
|
@ -1,5 +1,5 @@
|
|||
.modal {
|
||||
z-index: 9999;
|
||||
z-index: 99;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
|
|
|
@ -8,7 +8,8 @@ import styles from './newsEntry.module.css'
|
|||
export default function NewsEntry({
|
||||
newsItem,
|
||||
uid,
|
||||
onReact,
|
||||
onCommentReact,
|
||||
onNewsReact,
|
||||
onComment,
|
||||
onDelete,
|
||||
onPostDelete,
|
||||
|
@ -47,14 +48,14 @@ export default function NewsEntry({
|
|||
existingReacts={reacts}
|
||||
uid={uid}
|
||||
onClick={(reaction, isDelete) => {
|
||||
onReact({ type: 'news', reaction, isDelete })
|
||||
onNewsReact({ reaction, isDelete })
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<Comments
|
||||
uid={uid}
|
||||
onReact={(path, reaction, isDelete) => {
|
||||
onReact({ type: 'comment', path, reaction, isDelete })
|
||||
onCommentReact({ path, reaction, isDelete })
|
||||
}}
|
||||
onComment={onComment}
|
||||
onDelete={onDelete}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
border-radius: 6px;
|
||||
padding: 5px;
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
z-index: 9999;
|
||||
bottom: 100%;
|
||||
left: 0%;
|
||||
margin-left: -60px;
|
||||
|
|
|
@ -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', {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue