Showing error messages if trying to delete other users stuff

This commit is contained in:
mrfry 2021-03-18 18:21:51 +01:00
parent 6a2c22f24a
commit 4c4fb1dacc
2 changed files with 16 additions and 5 deletions

View file

@ -1,6 +1,7 @@
{ {
"siteUrl": "https://qmining.frylabs.net/", "siteUrl": "https://qmining.frylabs.net/",
"apiUrl": "https://api.frylabs.net/", "apiUrl": "https://api.frylabs.net/",
"devApiUrl": "http://localhost:8080/",
"mobileWindowWidth": 700, "mobileWindowWidth": 700,
"maxQuestionsToRender": 250 "maxQuestionsToRender": 250
} }

View file

@ -150,7 +150,11 @@ export default function Index({ globalData }) {
return res.json() return res.json()
}) })
.then((res) => { .then((res) => {
setNews(res.news) if (res.status === 'fail') {
alert(res.msg)
} else {
setNews(res.news)
}
}) })
}} }}
onNewsReact={({ reaction, isDelete }) => { onNewsReact={({ reaction, isDelete }) => {
@ -216,7 +220,11 @@ export default function Index({ globalData }) {
return res.json() return res.json()
}) })
.then((res) => { .then((res) => {
setNews(res.news) if (res.status === 'fail') {
alert(res.msg)
} else {
setNews(res.news)
}
}) })
}} }}
onComment={(path, content) => { onComment={(path, content) => {
@ -262,9 +270,11 @@ export default function Index({ globalData }) {
} }
console.log(type, title, content, file) console.log(type, title, content, file)
if (type === 'private') { if (type === 'private') {
postFeedback(content, file).then((/* { fileres, textres } */) => { postFeedback(content, file).then(
alert('Privát visszajelzés elküldve!') (/* { fileres, textres } */) => {
}) alert('Privát visszajelzés elküldve!')
}
)
} else { } else {
if (!title) { if (!title) {
alert('Üres a téma!') alert('Üres a téma!')