Remove success toast from Bookmark Button (#11054)
Co-authored-by: Eric Bailey <git@esb.lol>
This commit is contained in:
@@ -282,7 +282,7 @@
|
|||||||
"count": 2
|
"count": 2
|
||||||
},
|
},
|
||||||
"typescript/no-misused-promises": {
|
"typescript/no-misused-promises": {
|
||||||
"count": 2
|
"count": 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"src/components/PostControls/DiscoverDebug.tsx": {
|
"src/components/PostControls/DiscoverDebug.tsx": {
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ export const BookmarkButton = memo(function BookmarkButton({
|
|||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
const save = async ({disableUndo}: {disableUndo?: boolean} = {}) => {
|
const save = async () => {
|
||||||
try {
|
try {
|
||||||
await bookmark({
|
await bookmark({
|
||||||
action: 'create',
|
action: 'create',
|
||||||
@@ -59,25 +59,6 @@ export const BookmarkButton = memo(function BookmarkButton({
|
|||||||
logContext,
|
logContext,
|
||||||
feedDescriptor,
|
feedDescriptor,
|
||||||
})
|
})
|
||||||
|
|
||||||
toast.show(
|
|
||||||
<toast.Outer>
|
|
||||||
<toast.Icon />
|
|
||||||
<toast.Text>
|
|
||||||
<Trans>Post saved</Trans>
|
|
||||||
</toast.Text>
|
|
||||||
{!disableUndo && (
|
|
||||||
<toast.Action
|
|
||||||
label={undoLabel}
|
|
||||||
onPress={() => remove({disableUndo: true})}>
|
|
||||||
{undoLabel}
|
|
||||||
</toast.Action>
|
|
||||||
)}
|
|
||||||
</toast.Outer>,
|
|
||||||
{
|
|
||||||
type: 'success',
|
|
||||||
},
|
|
||||||
)
|
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
const {raw, clean} = cleanError(e)
|
const {raw, clean} = cleanError(e)
|
||||||
toast.show(clean || raw || e, {
|
toast.show(clean || raw || e, {
|
||||||
@@ -86,7 +67,7 @@ export const BookmarkButton = memo(function BookmarkButton({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const remove = async ({disableUndo}: {disableUndo?: boolean} = {}) => {
|
const remove = async () => {
|
||||||
try {
|
try {
|
||||||
await bookmark({
|
await bookmark({
|
||||||
action: 'delete',
|
action: 'delete',
|
||||||
@@ -106,13 +87,9 @@ export const BookmarkButton = memo(function BookmarkButton({
|
|||||||
<toast.Text>
|
<toast.Text>
|
||||||
<Trans>Removed from saved posts</Trans>
|
<Trans>Removed from saved posts</Trans>
|
||||||
</toast.Text>
|
</toast.Text>
|
||||||
{!disableUndo && (
|
<toast.Action label={undoLabel} onPress={() => save()}>
|
||||||
<toast.Action
|
{undoLabel}
|
||||||
label={undoLabel}
|
</toast.Action>
|
||||||
onPress={() => save({disableUndo: true})}>
|
|
||||||
{undoLabel}
|
|
||||||
</toast.Action>
|
|
||||||
)}
|
|
||||||
</toast.Outer>,
|
</toast.Outer>,
|
||||||
)
|
)
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
|
|||||||
Reference in New Issue
Block a user