From a91c263cbc0e28110e25922a29ed983df3192b6a Mon Sep 17 00:00:00 2001 From: thecodrr Date: Mon, 14 Sep 2020 15:08:47 +0500 Subject: [PATCH] feat: add toast when trash is cleared --- apps/web/src/views/trash.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/web/src/views/trash.js b/apps/web/src/views/trash.js index 5f6ffa6eb..9856673df 100644 --- a/apps/web/src/views/trash.js +++ b/apps/web/src/views/trash.js @@ -8,6 +8,7 @@ import { confirm } from "../components/dialogs/confirm"; import { useStore, store } from "../stores/trash-store"; import { toTitleCase } from "../utils/string"; import TrashPlaceholder from "../components/placeholders/trash-placeholder"; +import { showToast } from "../utils/toast"; function menuItems(item, index) { return [ @@ -69,10 +70,18 @@ function Trash() { confirm( Icon.Trash, "Clear", - `This action is irreversible. Are you sure you want to proceed?s` + `This action is irreversible. Are you sure you want to proceed?` ).then(async (res) => { if (res) { - await clearTrash(); + try { + await clearTrash(); + showToast("success", "Trash cleared successfully!"); + } catch (e) { + showToast( + "error", + `Could not clear trash. Error: ${e.message}` + ); + } } }); },