added error pop-up

This commit is contained in:
plebbitor
2023-03-13 22:15:57 +01:00
parent c66a782e53
commit ca304d9f23
7 changed files with 49 additions and 13 deletions
+3 -5
View File
@@ -7,6 +7,7 @@ import CaptchaModal from './CaptchaModal';
import { useFeed, useAccountsActions } from '@plebbit/plebbit-react-hooks';
import InfiniteScroll from 'react-infinite-scroller';
import { Tooltip } from 'react-tooltip';
import onError from '../utils/onError';
import getDate from '../utils/getDate';
import renderComments from '../utils/renderComments';
@@ -181,9 +182,6 @@ const Board = ({ setBodyStyle }) => {
}
const onError = (error) => console.error(error)
const getChallengeAnswersFromUser = async (challenges) => {
return new Promise((resolve, reject) => {
const imageString = challenges?.challenges[0].challenge;
@@ -268,14 +266,14 @@ const Board = ({ setBodyStyle }) => {
subplebbitAddress: selectedAddress,
onChallengeVerification,
onChallenge,
onError,
onError: onError,
});
console.log(`Comment pending with index: ${pendingComment.index}`);
setName('');
setSubject('');
setComment('');
} catch (error) {
console.error(error);
onError(error);
}
};
+3 -2
View File
@@ -7,6 +7,7 @@ import { Threads } from './styles/Catalog.styled';
import { useFeed, useAccountsActions } from '@plebbit/plebbit-react-hooks';
import ImageBanner from './ImageBanner';
import CaptchaModal from './CaptchaModal';
import onError from '../utils/onError';
import InfiniteScroll from 'react-infinite-scroller';
@@ -241,14 +242,14 @@ const Catalog = ({ setBodyStyle }) => {
subplebbitAddress: selectedAddress,
onChallengeVerification,
onChallenge,
onError,
onError: onError,
});
console.log(`Comment pending with index: ${pendingComment.index}`);
setName('');
setSubject('');
setComment('');
} catch (error) {
console.error(error);
onError(error);
}
};
+3 -5
View File
@@ -7,6 +7,7 @@ import { useComment, useAccountsActions } from '@plebbit/plebbit-react-hooks';
import ImageBanner from './ImageBanner';
import CaptchaModal from './CaptchaModal';
import { Tooltip } from 'react-tooltip';
import onError from '../utils/onError';
import getDate from '../utils/getDate';
import renderThreadComments from '../utils/renderThreadComments';
@@ -156,9 +157,6 @@ const Thread = ({ setBodyStyle }) => {
await comment.publishChallengeAnswers(challengeAnswers)
}
}
const onError = (error) => console.error(error)
const getChallengeAnswersFromUser = async (challenges) => {
@@ -241,14 +239,14 @@ const Thread = ({ setBodyStyle }) => {
subplebbitAddress: selectedAddress,
onChallengeVerification,
onChallenge,
onError,
onError: onError,
});
console.log(`Comment pending with index: ${pendingComment.index}`);
setName('');
setSubject('');
setCommentContent('');
} catch (error) {
console.error(error);
onError(error);
}
};