DmitrMakeev commited on
Commit
3c0d0cf
·
verified ·
1 Parent(s): 98142db

Update pages_gen.html

Browse files
Files changed (1) hide show
  1. pages_gen.html +35 -32
pages_gen.html CHANGED
@@ -23,43 +23,46 @@
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://api.notisend.ru/v1/email/lists/${groupId}`;
38
 
39
- fetch(url, {
40
- method: 'GET',
41
- headers: {
42
- 'Content-Type': 'application/json',
43
- 'Authorization': `Bearer ${apiToken}`
44
- }
45
- })
46
- .then(response => {
47
- if (!response.ok) {
48
- throw new Error('Network response was not ok ' + response.statusText);
49
- }
50
- return response.json();
51
- })
52
- .then(data => {
53
- resultDiv.innerHTML = `
54
- <p><strong>Идентификатор группы:</strong> ${data.id}</p>
55
- <p><strong>Название группы:</strong> ${data.title}</p>
56
- `;
57
- })
58
- .catch(error => {
59
- resultDiv.innerHTML = `<p style="color: red;">Ошибка: ${error.message}</p>`;
 
 
 
 
 
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>