Skip to content

Commit

Permalink
Merge pull request #1666 from acm-ucr/nidheesh-m-vakharia/toaster-util
Browse files Browse the repository at this point in the history
Typescript: Toaster Util
  • Loading branch information
shahdivyank authored Aug 1, 2024
2 parents 7602880 + 4320695 commit 26ac56d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
7 changes: 0 additions & 7 deletions src/utils/toaster.js

This file was deleted.

15 changes: 15 additions & 0 deletions src/utils/toaster.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { toast, ToastType } from "react-hot-toast";

const toaster: Record<ToastType, (message: string) => string> = {
success: toast.success,
error: toast.error,
loading: toast.loading,
blank: toast.custom,
custom: toast.custom,
};

const Toaster = (message: string, type: ToastType): string => {
return toaster[type](message);
};

export default Toaster;

0 comments on commit 26ac56d

Please sign in to comment.