Implement logging system
This commit is contained in:
parent
99cec71ed7
commit
f6a0e634d7
39 changed files with 442 additions and 125 deletions
|
@ -22,15 +22,15 @@ export const PostRepostedBy = observer(function PostRepostedBy({
|
|||
|
||||
useEffect(() => {
|
||||
if (view?.params.uri === uri) {
|
||||
console.log('Reposted by doing nothing')
|
||||
return // no change needed? or trigger refresh?
|
||||
}
|
||||
console.log('Fetching Reposted by', uri)
|
||||
const newView = new RepostedByViewModel(store, {uri})
|
||||
setView(newView)
|
||||
newView
|
||||
.setup()
|
||||
.catch(err => console.error('Failed to fetch reposted by', err))
|
||||
.catch(err =>
|
||||
store.log.error('Failed to fetch reposted by', err.toString()),
|
||||
)
|
||||
}, [uri, view?.params.uri, store])
|
||||
|
||||
const onRefresh = () => {
|
||||
|
|
|
@ -18,7 +18,14 @@ export const PostThread = observer(function PostThread({
|
|||
const ref = useRef<FlatList>(null)
|
||||
const posts = view.thread ? Array.from(flattenThread(view.thread)) : []
|
||||
const onRefresh = () => {
|
||||
view?.refresh().catch(err => console.error('Failed to refresh', err))
|
||||
view
|
||||
?.refresh()
|
||||
.catch(err =>
|
||||
view.rootStore.log.error(
|
||||
'Failed to refresh posts thread',
|
||||
err.toString(),
|
||||
),
|
||||
)
|
||||
}
|
||||
const onLayout = () => {
|
||||
const index = posts.findIndex(post => post._isHighlightedPost)
|
||||
|
|
|
@ -72,12 +72,12 @@ export const PostThreadItem = observer(function PostThreadItem({
|
|||
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)
|
||||
|
@ -90,7 +90,7 @@ export const PostThreadItem = observer(function PostThreadItem({
|
|||
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')
|
||||
},
|
||||
)
|
||||
|
|
|
@ -24,13 +24,13 @@ export const PostVotedBy = observer(function PostVotedBy({
|
|||
|
||||
useEffect(() => {
|
||||
if (view?.params.uri === uri) {
|
||||
console.log('Voted by doing nothing')
|
||||
return // no change needed? or trigger refresh?
|
||||
}
|
||||
console.log('Fetching voted by', uri)
|
||||
const newView = new VotesViewModel(store, {uri, direction})
|
||||
setView(newView)
|
||||
newView.setup().catch(err => console.error('Failed to fetch voted by', err))
|
||||
newView
|
||||
.setup()
|
||||
.catch(err => store.log.error('Failed to fetch voted by', err.toString()))
|
||||
}, [uri, view?.params.uri, store])
|
||||
|
||||
const onRefresh = () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue