Move metric to try body

This commit is contained in:
Eric Bailey
2025-03-06 14:08:21 -06:00
parent da1949b256
commit 5ee3c49cd2
+20 -24
View File
@@ -393,76 +393,72 @@ function Header({
try {
await listMuteMutation.mutateAsync({uri: list.uri, mute: true})
Toast.show(_(msg({message: 'List muted', context: 'toast'})))
logger.metric(
'moderation:subscribedToList',
{listType: 'mute'},
{statsig: true},
)
} catch {
Toast.show(
_(
msg`There was an issue. Please check your internet connection and try again.`,
),
)
return
}
logger.metric(
'moderation:subscribedToList',
{listType: 'mute'},
{statsig: true},
)
}, [list, listMuteMutation, _])
const onUnsubscribeMute = useCallback(async () => {
try {
await listMuteMutation.mutateAsync({uri: list.uri, mute: false})
Toast.show(_(msg({message: 'List unmuted', context: 'toast'})))
logger.metric(
'moderation:unsubscribedFromList',
{listType: 'mute'},
{statsig: true},
)
} catch {
Toast.show(
_(
msg`There was an issue. Please check your internet connection and try again.`,
),
)
return
}
logger.metric(
'moderation:unsubscribedFromList',
{listType: 'mute'},
{statsig: true},
)
}, [list, listMuteMutation, _])
const onSubscribeBlock = useCallback(async () => {
try {
await listBlockMutation.mutateAsync({uri: list.uri, block: true})
Toast.show(_(msg({message: 'List blocked', context: 'toast'})))
logger.metric(
'moderation:subscribedToList',
{listType: 'block'},
{statsig: true},
)
} catch {
Toast.show(
_(
msg`There was an issue. Please check your internet connection and try again.`,
),
)
return
}
logger.metric(
'moderation:subscribedToList',
{listType: 'block'},
{statsig: true},
)
}, [list, listBlockMutation, _])
const onUnsubscribeBlock = useCallback(async () => {
try {
await listBlockMutation.mutateAsync({uri: list.uri, block: false})
Toast.show(_(msg({message: 'List unblocked', context: 'toast'})))
logger.metric(
'moderation:unsubscribedFromList',
{listType: 'block'},
{statsig: true},
)
} catch {
Toast.show(
_(
msg`There was an issue. Please check your internet connection and try again.`,
),
)
return
}
logger.metric(
'moderation:unsubscribedFromList',
{listType: 'block'},
{statsig: true},
)
}, [list, listBlockMutation, _])
const onPressEdit = useCallback(() => {