From d57fe9f48853f54731a6389a8a2bdfa0dc98eaac Mon Sep 17 00:00:00 2001
From: Davor <davor.ivankovic@init.hr>
Date: Wed, 27 Jul 2022 13:44:00 +0200
Subject: [PATCH] add duration to toast show until closed for batch users

---
 src/common/util/show-toast.tsx      | 6 +++---
 src/services/users/redux/actions.ts | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/common/util/show-toast.tsx b/src/common/util/show-toast.tsx
index 351a9855..0ab0f3c3 100644
--- a/src/common/util/show-toast.tsx
+++ b/src/common/util/show-toast.tsx
@@ -9,7 +9,7 @@ export enum ToastType {
   Error = 'error',
 }
 
-export const showToast = (text: string, type?: ToastType) => {
+export const showToast = (text: string, type?: ToastType, duration?: number) => {
   switch (type) {
     case ToastType.Error:
       toast.custom(
@@ -47,7 +47,7 @@ export const showToast = (text: string, type?: ToastType) => {
             </div>
           </Transition>
         ),
-        { position: 'top-right' },
+        { position: 'top-right', duration },
       );
       break;
     default:
@@ -86,7 +86,7 @@ export const showToast = (text: string, type?: ToastType) => {
             </div>
           </Transition>
         ),
-        { position: 'top-right' },
+        { position: 'top-right', duration },
       );
   }
 };
diff --git a/src/services/users/redux/actions.ts b/src/services/users/redux/actions.ts
index a09b5902..7643b41e 100644
--- a/src/services/users/redux/actions.ts
+++ b/src/services/users/redux/actions.ts
@@ -228,13 +228,13 @@ export const createBatchUsers = (users: any) => async (dispatch: Dispatch<any>)
 
     // show information about created users
     if (!_.isEmpty(responseData.success)) {
-      showToast(responseData.success.message, ToastType.Success);
+      showToast(responseData.success.message, ToastType.Success, Infinity);
     }
     if (!_.isEmpty(responseData.existing)) {
-      showToast(responseData.existing.message, ToastType.Error);
+      showToast(responseData.existing.message, ToastType.Error, Infinity);
     }
     if (!_.isEmpty(responseData.failed)) {
-      showToast(responseData.failed.message, ToastType.Error);
+      showToast(responseData.failed.message, ToastType.Error, Infinity);
     }
 
     dispatch(fetchUsers());
-- 
GitLab