Spaces:
Sleeping
Sleeping
Update pages_gen.html
Browse files- pages_gen.html +0 -65
pages_gen.html
CHANGED
@@ -4,71 +4,6 @@
|
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<title>Получение информации о группе</title>
|
7 |
-
</head>
|
8 |
-
<body>
|
9 |
-
<h1>Получение информации о группе</h1>
|
10 |
-
<form id="groupForm">
|
11 |
-
<label for="groupId">Идентификатор группы:</label>
|
12 |
-
<input type="text" id="groupId" name="groupId" required>
|
13 |
-
<br>
|
14 |
-
<label for="groupName">Название группы (опционально):</label>
|
15 |
-
<input type="text" id="groupName" name="groupName">
|
16 |
-
<br>
|
17 |
-
<label for="apiToken">API Токен:</label>
|
18 |
-
<input type="text" id="apiToken" name="apiToken" required>
|
19 |
-
<br>
|
20 |
-
<button type="submit">Получить информацию о группе</button>
|
21 |
-
</form>
|
22 |
-
<div id="result"></div>
|
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>
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
|
73 |
|
74 |
|
|
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<title>Получение информации о группе</title>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
|
9 |
|