sweetalertcomplet
This commit is contained in:
@@ -3,6 +3,7 @@ import axios from "axios";
|
||||
import { envConfig } from "@/app/lib/config";
|
||||
import { useState } from "react";
|
||||
import toast from "react-hot-toast";
|
||||
import Swal from "sweetalert2";
|
||||
|
||||
interface Data {
|
||||
nombre_equipo: string;
|
||||
@@ -84,10 +85,20 @@ export default function Equipos() {
|
||||
});
|
||||
|
||||
setIsEditing(false);
|
||||
toast.success("Equipo actualizado correctamente");
|
||||
|
||||
Swal.fire({
|
||||
title: "Equipo actualizado correctamente!",
|
||||
icon: "success",
|
||||
draggable: true
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
toast.error("Error al guardar el equipo");
|
||||
|
||||
Swal.fire({
|
||||
title: "Error al guardar el equipo!",
|
||||
icon: "error",
|
||||
draggable: true
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -118,7 +129,12 @@ export default function Equipos() {
|
||||
setIsCreating(true);
|
||||
setIsEditing(true);
|
||||
} catch (error) {
|
||||
toast.error("Error al preparar formulario");
|
||||
|
||||
Swal.fire({
|
||||
title: "Error al preparar formulario!",
|
||||
icon: "error",
|
||||
draggable: true
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -132,7 +148,12 @@ export default function Equipos() {
|
||||
ip: "0.0.0.0",
|
||||
});
|
||||
|
||||
toast.success("Equipo creado correctamente");
|
||||
|
||||
Swal.fire({
|
||||
title: "Equipo creado correctamente!",
|
||||
icon: "success",
|
||||
draggable: true
|
||||
});
|
||||
|
||||
setIsCreating(false);
|
||||
setIsEditing(false);
|
||||
|
||||
Reference in New Issue
Block a user