FarelDeveloper commited on
Commit
da7a97d
·
verified ·
1 Parent(s): d2e9663

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +8 -4
index.html CHANGED
@@ -28,16 +28,19 @@ button{background:#38bdf8;border:0;cursor:pointer}
28
  let currentEmail = null;
29
  let timer = null;
30
 
31
- // load domain
32
  async function loadDomains(){
33
  const r = await fetch('/api/domains');
34
  const j = await r.json();
 
 
35
  j.domains.forEach(d=>{
36
- domain.innerHTML += `<option>${d}</option>`;
 
37
  });
38
  }
39
 
40
- // create email
41
  async function createEmail(){
42
  const r = await fetch('/api/email/new',{
43
  method:'POST',
@@ -57,7 +60,7 @@ async function createEmail(){
57
  timer = setInterval(loadInbox, 5000);
58
  }
59
 
60
- // load inbox
61
  async function loadInbox(){
62
  if(!currentEmail) return;
63
  const r = await fetch('/api/email/' + currentEmail + '/messages');
@@ -74,5 +77,6 @@ async function loadInbox(){
74
 
75
  loadDomains();
76
  </script>
 
77
  </body>
78
  </html>
 
28
  let currentEmail = null;
29
  let timer = null;
30
 
31
+ // 🔧 FIX DI SINI
32
  async function loadDomains(){
33
  const r = await fetch('/api/domains');
34
  const j = await r.json();
35
+
36
+ domain.innerHTML = '';
37
  j.domains.forEach(d=>{
38
+ const dom = typeof d === 'string' ? d : d.name;
39
+ domain.innerHTML += `<option value="${dom}">${dom}</option>`;
40
  });
41
  }
42
 
43
+ // TIDAK DIUBAH
44
  async function createEmail(){
45
  const r = await fetch('/api/email/new',{
46
  method:'POST',
 
60
  timer = setInterval(loadInbox, 5000);
61
  }
62
 
63
+ // TIDAK DIUBAH
64
  async function loadInbox(){
65
  if(!currentEmail) return;
66
  const r = await fetch('/api/email/' + currentEmail + '/messages');
 
77
 
78
  loadDomains();
79
  </script>
80
+
81
  </body>
82
  </html>