Fix redux actions

This commit is contained in:
Rafael 2022-02-07 16:39:27 -03:00 committed by Thomas Zarebczan
parent c758c59066
commit 59a06dbc3b

View file

@ -61,9 +61,9 @@ type Props = {
doCommentCreate: (uri: string, isLivestream?: boolean, params: CommentSubmitParams) => Promise<any>, doCommentCreate: (uri: string, isLivestream?: boolean, params: CommentSubmitParams) => Promise<any>,
doFetchCreatorSettings: (channelId: string) => Promise<any>, doFetchCreatorSettings: (channelId: string) => Promise<any>,
doToast: ({ message: string }) => void, doToast: ({ message: string }) => void,
doCommentById: (commentId: string) => Promise<any>, doCommentById: (commentId: string, toastIfNotFound: boolean) => Promise<any>,
doSendCashTip: (TipParams, UserParams, string, ?string, (any) => void) => string, doSendCashTip: (TipParams, anonymous: boolean, UserParams, claimId: string, stripe: ?string, (any) => void) => string,
doSendTip: ({}, (any) => void, (any) => void) => void, doSendTip: (params: {}, isSupport: boolean, successCb: (any) => void, errorCb: (any) => void, boolean) => void,
doOpenModal: (id: string, any) => void, doOpenModal: (id: string, any) => void,
}; };
@ -271,6 +271,7 @@ export function CommentCreate(props: Props) {
// second parameter is callback // second parameter is callback
doSendTip( doSendTip(
params, params,
false,
(response) => { (response) => {
const { txid } = response; const { txid } = response;
// todo: why the setTimeout? // todo: why the setTimeout?
@ -290,13 +291,14 @@ export function CommentCreate(props: Props) {
() => { () => {
// reset the frontend so people can send a new comment // reset the frontend so people can send a new comment
setSubmitting(false); setSubmitting(false);
} },
false
); );
} else { } else {
const tipParams: TipParams = { tipAmount: Math.round(tipAmount * 100) / 100, tipChannelName, channelClaimId }; const tipParams: TipParams = { tipAmount: Math.round(tipAmount * 100) / 100, tipChannelName, channelClaimId };
const userParams: UserParams = { activeChannelName, activeChannelId: activeChannelClaimId }; const userParams: UserParams = { activeChannelName, activeChannelId: activeChannelClaimId };
doSendCashTip(tipParams, userParams, claimId, stripeEnvironment, (customerTipResponse) => { doSendCashTip(tipParams, false, userParams, claimId, stripeEnvironment, (customerTipResponse) => {
const { payment_intent_id } = customerTipResponse; const { payment_intent_id } = customerTipResponse;
handleCreateComment(null, payment_intent_id, stripeEnvironment); handleCreateComment(null, payment_intent_id, stripeEnvironment);
@ -393,7 +395,7 @@ export function CommentCreate(props: Props) {
// Notifications: Fetch top-level comments to identify if it has been deleted and can reply to it // Notifications: Fetch top-level comments to identify if it has been deleted and can reply to it
React.useEffect(() => { React.useEffect(() => {
if (shouldFetchComment && doCommentById) { if (shouldFetchComment && doCommentById) {
doCommentById(parentId).then((result) => { doCommentById(parentId, false).then((result) => {
setDeletedComment(String(result).includes('Error')); setDeletedComment(String(result).includes('Error'));
}); });
} }