Skip to content

Commit

Permalink
fix: use correct type for options and allow for false autoclose
Browse files Browse the repository at this point in the history
  • Loading branch information
rickimoore committed Aug 3, 2023
1 parent fd9d2ca commit 7800565
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/utilities/displayToast.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { toast } from 'react-toastify'
import { ToastType } from '../types'
import { ToastOptions } from 'react-toastify/dist/types'

const displayToast = (message: string, type: ToastType, options?: any) => {
const displayToast = (message: string, type: ToastType, options?: ToastOptions) => {
const toastOptions = {
position: options?.position || 'top-right',
autoClose: options?.autoClose || 5000,
autoClose: options?.autoClose ?? 5000,
style: type === ToastType.SUCCESS ? { background: '#70D370' } : undefined,
theme: options?.theme || 'colored',
hideProgressBar: options?.hideProgressBar || true,
Expand Down

0 comments on commit 7800565

Please sign in to comment.