diff --git a/src/shared/error.ts b/src/shared/error.ts new file mode 100644 index 0000000..384e8d6 --- /dev/null +++ b/src/shared/error.ts @@ -0,0 +1,20 @@ +import { ToastController } from '@ionic/angular'; + +const toast = new ToastController(); + +const onToast = async (message: string, color: string = 'success') => { + const instance = await toast.create({ + message, + color, + duration: 2000 + }); + return instance.present(); +}; + +export const onError = async (message: string) => { + return onToast(message, 'danger'); +}; + +export const onSuccess = async (message: string) => { + return onToast(message); +};