Spaces:
Sleeping
Sleeping
Update pages_gen.html
Browse files- pages_gen.html +60 -0
pages_gen.html
CHANGED
@@ -65,4 +65,64 @@
|
|
65 |
});
|
66 |
</script>
|
67 |
</body>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
</html>
|
|
|
65 |
});
|
66 |
</script>
|
67 |
</body>
|
68 |
+
</html>
|
69 |
+
|
70 |
+
|
71 |
+
|
72 |
+
|
73 |
+
|
74 |
+
|
75 |
+
</head>
|
76 |
+
<body>
|
77 |
+
<h1>Получение информации о группе</h1>
|
78 |
+
<form id="groupForm">
|
79 |
+
<label for="groupId">Идентификатор группы:</label>
|
80 |
+
<input type="text" id="groupId" name="groupId" required>
|
81 |
+
<br>
|
82 |
+
<label for="apiToken">API Токен:</label>
|
83 |
+
<input type="text" id="apiToken" name="apiToken" required>
|
84 |
+
<br>
|
85 |
+
<button type="submit">Получить информацию о группе</button>
|
86 |
+
</form>
|
87 |
+
<div id="result"></div>
|
88 |
+
|
89 |
+
<script>
|
90 |
+
document.addEventListener('DOMContentLoaded', function() {
|
91 |
+
const groupForm = document.getElementById('groupForm');
|
92 |
+
const resultDiv = document.getElementById('result');
|
93 |
+
|
94 |
+
groupForm.addEventListener('submit', function(event) {
|
95 |
+
event.preventDefault();
|
96 |
+
|
97 |
+
const groupId = document.getElementById('groupId').value;
|
98 |
+
const apiToken = document.getElementById('apiToken').value;
|
99 |
+
|
100 |
+
const url = `https://test-sj-crm-psy-vk.hf.space/api/group/${groupId}?apiToken=${apiToken}`;
|
101 |
+
|
102 |
+
fetch(url, {
|
103 |
+
method: 'GET',
|
104 |
+
headers: {
|
105 |
+
'Content-Type': 'application/json'
|
106 |
+
}
|
107 |
+
})
|
108 |
+
.then(response => {
|
109 |
+
if (!response.ok) {
|
110 |
+
throw new Error('Network response was not ok ' + response.statusText);
|
111 |
+
}
|
112 |
+
return response.json();
|
113 |
+
})
|
114 |
+
.then(data => {
|
115 |
+
if (data.error) {
|
116 |
+
resultDiv.innerHTML = `<p style="color: red;">Ошибка: ${data.error}</p>`;
|
117 |
+
} else {
|
118 |
+
resultDiv.innerHTML = `<pre>${JSON.stringify(data, null, 2)}</pre>`;
|
119 |
+
}
|
120 |
+
})
|
121 |
+
.catch(error => {
|
122 |
+
resultDiv.innerHTML = `<p style="color: red;">Ошибка: ${error.message}</p>`;
|
123 |
+
});
|
124 |
+
});
|
125 |
+
});
|
126 |
+
</script>
|
127 |
+
</body>
|
128 |
</html>
|