call publish event if report call fails
This commit is contained in:
parent
4420983a79
commit
9f40b7ff7c
1 changed files with 6 additions and 2 deletions
|
@ -12,6 +12,7 @@ import usePersistedState from 'effects/use-persisted-state';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
import Yrbl from 'component/yrbl';
|
import Yrbl from 'component/yrbl';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
|
import analytics from 'analytics';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
channels: Array<ChannelClaim>,
|
channels: Array<ChannelClaim>,
|
||||||
|
@ -45,8 +46,9 @@ export default function CreatorAnalytics(props: Props) {
|
||||||
}
|
}
|
||||||
}, [selectedChannelUrl, firstChannelUrl, channelFoundForSelectedChannelUrl]);
|
}, [selectedChannelUrl, firstChannelUrl, channelFoundForSelectedChannelUrl]);
|
||||||
|
|
||||||
|
const channelForEffect = JSON.stringify(selectedChannelClaim);
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (selectedChannelClaimId) {
|
if (selectedChannelClaimId && channelForEffect) {
|
||||||
setFetchingStats(true);
|
setFetchingStats(true);
|
||||||
Lbryio.call('reports', 'content', { claim_id: selectedChannelClaimId })
|
Lbryio.call('reports', 'content', { claim_id: selectedChannelClaimId })
|
||||||
.then(res => {
|
.then(res => {
|
||||||
|
@ -54,10 +56,12 @@ export default function CreatorAnalytics(props: Props) {
|
||||||
setStats(res);
|
setStats(res);
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
|
const channelToSend = JSON.parse(channelForEffect);
|
||||||
|
analytics.apiLogPublish(channelToSend);
|
||||||
setFetchingStats(false);
|
setFetchingStats(false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [selectedChannelClaimId, setFetchingStats, setStats]);
|
}, [selectedChannelClaimId, channelForEffect, setFetchingStats, setStats]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
|
|
Loading…
Add table
Reference in a new issue