Implement logging system
This commit is contained in:
parent
99cec71ed7
commit
f6a0e634d7
39 changed files with 442 additions and 125 deletions
|
@ -53,10 +53,21 @@ export const Feed = observer(function Feed({
|
|||
}
|
||||
}
|
||||
const onRefresh = () => {
|
||||
feed.refresh().catch(err => console.error('Failed to refresh', err))
|
||||
feed
|
||||
.refresh()
|
||||
.catch(err =>
|
||||
feed.rootStore.log.error(
|
||||
'Failed to refresh posts feed',
|
||||
err.toString(),
|
||||
),
|
||||
)
|
||||
}
|
||||
const onEndReached = () => {
|
||||
feed.loadMore().catch(err => console.error('Failed to load more', err))
|
||||
feed
|
||||
.loadMore()
|
||||
.catch(err =>
|
||||
feed.rootStore.log.error('Failed to load more posts', err.toString()),
|
||||
)
|
||||
}
|
||||
let data
|
||||
if (feed.hasLoaded) {
|
||||
|
|
|
@ -69,12 +69,12 @@ export const FeedItem = observer(function ({
|
|||
const onPressToggleRepost = () => {
|
||||
item
|
||||
.toggleRepost()
|
||||
.catch(e => console.error('Failed to toggle repost', record, e))
|
||||
.catch(e => store.log.error('Failed to toggle repost', e.toString()))
|
||||
}
|
||||
const onPressToggleUpvote = () => {
|
||||
item
|
||||
.toggleUpvote()
|
||||
.catch(e => console.error('Failed to toggle upvote', record, e))
|
||||
.catch(e => store.log.error('Failed to toggle upvote', e.toString()))
|
||||
}
|
||||
const onCopyPostText = () => {
|
||||
Clipboard.setString(record.text)
|
||||
|
@ -87,7 +87,7 @@ export const FeedItem = observer(function ({
|
|||
Toast.show('Post deleted')
|
||||
},
|
||||
e => {
|
||||
console.error(e)
|
||||
store.log.error('Failed to delete post', e.toString())
|
||||
Toast.show('Failed to delete post, please try again')
|
||||
},
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue