mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Show success/error toasts for archiving and removing
This commit is contained in:
parent
c668835c3a
commit
0a459a20c4
1 changed files with 20 additions and 0 deletions
|
|
@ -7,6 +7,7 @@ import { setLinkArchivedMutation } from '../mutations/setLinkArchivedMutation'
|
|||
import { deleteLinkMutation } from '../mutations/deleteLinkMutation'
|
||||
import { articleReadingProgressMutation } from '../mutations/articleReadingProgressMutation'
|
||||
import { Label } from './useGetLabelsQuery'
|
||||
import { showErrorToast, showSuccessToast } from '../../toastHelpers'
|
||||
|
||||
export type LibraryItemsQueryInput = {
|
||||
limit: number
|
||||
|
|
@ -206,6 +207,12 @@ export function useGetLibraryItemsQuery({
|
|||
setLinkArchivedMutation({
|
||||
linkId: item.node.id,
|
||||
archived: true,
|
||||
}).then((res) => {
|
||||
if (res) {
|
||||
showSuccessToast('Link archived', { position: 'bottom-right' })
|
||||
} else {
|
||||
showErrorToast('Error archiving link', { position: 'bottom-right' })
|
||||
}
|
||||
})
|
||||
|
||||
break
|
||||
|
|
@ -225,11 +232,24 @@ export function useGetLibraryItemsQuery({
|
|||
setLinkArchivedMutation({
|
||||
linkId: item.node.id,
|
||||
archived: false,
|
||||
}).then((res) => {
|
||||
if (res) {
|
||||
showSuccessToast('Link unarchived', { position: 'bottom-right' })
|
||||
} else {
|
||||
showErrorToast('Error unarchiving link', { position: 'bottom-right' })
|
||||
}
|
||||
})
|
||||
break
|
||||
case 'delete':
|
||||
updateData(undefined)
|
||||
deleteLinkMutation(item.node.id)
|
||||
.then((res) => {
|
||||
if (res) {
|
||||
showSuccessToast('Link removed', { position: 'bottom-right' })
|
||||
} else {
|
||||
showErrorToast('Error removing link', { position: 'bottom-right' })
|
||||
}
|
||||
})
|
||||
break
|
||||
case 'mark-read':
|
||||
updateData({
|
||||
|
|
|
|||
Loading…
Reference in a new issue