Spaces:
Sleeping
Sleeping
Update pages_gen.html
Browse files- pages_gen.html +35 -32
pages_gen.html
CHANGED
@@ -23,43 +23,46 @@
|
|
23 |
|
24 |
|
25 |
<script>
|
26 |
-
document.addEventListener('DOMContentLoaded', function() {
|
27 |
-
|
28 |
-
|
29 |
|
30 |
-
|
31 |
-
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
|
37 |
-
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
60 |
});
|
61 |
-
});
|
62 |
-
});
|
63 |
</script>
|
64 |
</body>
|
65 |
</html>
|
|
|
23 |
|
24 |
|
25 |
<script>
|
26 |
+
document.addEventListener('DOMContentLoaded', function() {
|
27 |
+
const groupForm = document.getElementById('groupForm');
|
28 |
+
const resultDiv = document.getElementById('result');
|
29 |
|
30 |
+
groupForm.addEventListener('submit', function(event) {
|
31 |
+
event.preventDefault();
|
32 |
|
33 |
+
const groupId = document.getElementById('groupId').value;
|
34 |
+
const groupName = document.getElementById('groupName').value;
|
35 |
+
const apiToken = document.getElementById('apiToken').value;
|
36 |
|
37 |
+
const url = `https://test-sj-crm-psy-vk.hf.space/api/group/${groupId}?apiToken=${apiToken}`;
|
38 |
|
39 |
+
fetch(url, {
|
40 |
+
method: 'GET',
|
41 |
+
headers: {
|
42 |
+
'Content-Type': 'application/json'
|
43 |
+
}
|
44 |
+
})
|
45 |
+
.then(response => {
|
46 |
+
if (!response.ok) {
|
47 |
+
throw new Error('Network response was not ok ' + response.statusText);
|
48 |
+
}
|
49 |
+
return response.json();
|
50 |
+
})
|
51 |
+
.then(data => {
|
52 |
+
if (data.error) {
|
53 |
+
resultDiv.innerHTML = `<p style="color: red;">Ошибка: ${data.error}</p>`;
|
54 |
+
} else {
|
55 |
+
resultDiv.innerHTML = `
|
56 |
+
<p><strong>Идентификатор группы:</strong> ${data.id}</p>
|
57 |
+
<p><strong>Название группы:</strong> ${data.title}</p>
|
58 |
+
`;
|
59 |
+
}
|
60 |
+
})
|
61 |
+
.catch(error => {
|
62 |
+
resultDiv.innerHTML = `<p style="color: red;">Ошибка: ${error.message}</p>`;
|
63 |
+
});
|
64 |
+
});
|
65 |
});
|
|
|
|
|
66 |
</script>
|
67 |
</body>
|
68 |
</html>
|