From 4c4fb1dacce3306de27407b501000851822394a4 Mon Sep 17 00:00:00 2001 From: mrfry Date: Thu, 18 Mar 2021 18:21:51 +0100 Subject: [PATCH] Showing error messages if trying to delete other users stuff --- src/constants.json | 1 + src/pages/index.js | 20 +++++++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/constants.json b/src/constants.json index 8650745..09a2c16 100644 --- a/src/constants.json +++ b/src/constants.json @@ -1,6 +1,7 @@ { "siteUrl": "https://qmining.frylabs.net/", "apiUrl": "https://api.frylabs.net/", + "devApiUrl": "http://localhost:8080/", "mobileWindowWidth": 700, "maxQuestionsToRender": 250 } diff --git a/src/pages/index.js b/src/pages/index.js index 1ff39c1..9bdd676 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -150,7 +150,11 @@ export default function Index({ globalData }) { return res.json() }) .then((res) => { - setNews(res.news) + if (res.status === 'fail') { + alert(res.msg) + } else { + setNews(res.news) + } }) }} onNewsReact={({ reaction, isDelete }) => { @@ -216,7 +220,11 @@ export default function Index({ globalData }) { return res.json() }) .then((res) => { - setNews(res.news) + if (res.status === 'fail') { + alert(res.msg) + } else { + setNews(res.news) + } }) }} onComment={(path, content) => { @@ -262,9 +270,11 @@ export default function Index({ globalData }) { } console.log(type, title, content, file) if (type === 'private') { - postFeedback(content, file).then((/* { fileres, textres } */) => { - alert('Privát visszajelzés elküldve!') - }) + postFeedback(content, file).then( + (/* { fileres, textres } */) => { + alert('Privát visszajelzés elküldve!') + } + ) } else { if (!title) { alert('Üres a téma!')