File size: 228 Bytes
90cbf22
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
import { toast } from 'react-toastify';

export async function toastOnError<T>(promise: Promise<T>): Promise<T> {
  try {
    return await promise;
  } catch (error: any) {
    toast.error(error.message);
    throw error;
  }
}