import { Injectable } from '@angular/core';
import { ToastController } from '@ionic/angular';

@Injectable({
	providedIn: 'root'
})
export class ToastService {

	constructor(public toastController: ToastController) { }

	async presentToast(message: string, color?: string) {
		const toast = await this.toastController.create({
			message: message,
			position: 'bottom',
			duration: 4000,
			color: color? color: 'danger',
			buttons: [{
				text: 'OK',
				role: 'cancel',
			}]
		});
		toast.present();
	}
}
