forked from SymfonyCasts/symfony-ux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsweetalert-paste-in-swal.diff
33 lines (32 loc) · 1.04 KB
/
sweetalert-paste-in-swal.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
diff --git a/assets/controllers/submit-confirm_controller.js b/assets/controllers/submit-confirm_controller.js
index 5ea0ca2..c126518 100644
--- a/assets/controllers/submit-confirm_controller.js
+++ b/assets/controllers/submit-confirm_controller.js
@@ -1,8 +1,27 @@
import { Controller } from 'stimulus';
+import Swal from 'sweetalert2';
export default class extends Controller {
onSubmit(event) {
event.preventDefault();
- console.log(event);
+
+ Swal.fire({
+ title: 'Are you sure?',
+ text: "You won't be able to revert this!",
+ icon: 'warning',
+ showCancelButton: true,
+ confirmButtonColor: '#3085d6',
+ cancelButtonColor: '#d33',
+ confirmButtonText: 'Yes, delete it!',
+ }).then((result) => {
+ if (result.isConfirmed) {
+ Swal.fire(
+ 'Deleted!',
+ 'Your file has been deleted.',
+ 'success',
+ )
+ }
+ })
+
}
}