|
1 |
| -import * as bootstrap from 'bootstrap' |
2 |
| - |
3 | 1 | document.addEventListener('DOMContentLoaded', function() {
|
4 | 2 | // Initialize the Bootstrap modal
|
5 | 3 | var signUpModalElement = document.getElementById('signUpModal');
|
6 | 4 | if (!signUpModalElement) {
|
7 | 5 | console.error('Sign Up modal element not found');
|
8 | 6 | return;
|
9 | 7 | }
|
10 |
| - var signUpModal = new bootstrap.Modal(signUpModalElement); |
11 | 8 |
|
12 | 9 | var modalTitle = document.getElementById('signUpLabel');
|
13 | 10 | var modalBody = document.querySelector('#signUpModal .modal-body');
|
@@ -53,7 +50,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
53 | 50 | })
|
54 | 51 | .then(data => {
|
55 | 52 | console.log('Success:', data);
|
56 |
| - signUpModal.hide(); |
| 53 | + document.getElementById('signupModal').querySelector('.close').click(); // Close the modal |
57 | 54 | document.getElementById('signUpForm').reset();
|
58 | 55 | })
|
59 | 56 | .catch(error => {
|
@@ -104,14 +101,4 @@ document.addEventListener('DOMContentLoaded', function() {
|
104 | 101 | document.getElementById('signUpPassword').value = '';
|
105 | 102 | document.getElementById('signUpRePassword').value = '';
|
106 | 103 | }
|
107 |
| - |
108 |
| - // Reset form fields and hide error message when modal is hidden (on modal close) |
109 |
| - signUpModal._element.addEventListener('hidden.bs.modal', function () { |
110 |
| - document.getElementById('signUpForm').reset(); |
111 |
| - // Remove any error messages |
112 |
| - const errorSpans = document.querySelectorAll('#signUpModal .ErrorMessage'); |
113 |
| - errorSpans.forEach(function(errorSpan) { |
114 |
| - errorSpan.remove(); |
115 |
| - }); |
116 |
| - }); |
117 | 104 | });
|
0 commit comments