Fix: domain delete uses name instead of id
Backend routes expect domain name (string), not id (number). Frontend was passing domain.id but should pass domain.name.
This commit is contained in:
parent
4378bd0a99
commit
118b709275
1 changed files with 4 additions and 4 deletions
|
|
@ -64,10 +64,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function deleteDomain(id: number) {
|
async function deleteDomain(name: string) {
|
||||||
if (!confirm('Delete this domain? Users and aliases will be deleted.')) return;
|
if (!confirm(`Delete domain ${name}? Users and aliases will be deleted.`)) return;
|
||||||
try {
|
try {
|
||||||
await fetch(`/api/domains/${id}`, {
|
await fetch(`/api/domains/${name}`, {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
headers: { Authorization: `Bearer ${localStorage.getItem('token')}` }
|
headers: { Authorization: `Bearer ${localStorage.getItem('token')}` }
|
||||||
});
|
});
|
||||||
|
|
@ -125,7 +125,7 @@
|
||||||
<td>{domain.userCount}</td>
|
<td>{domain.userCount}</td>
|
||||||
<td>{domain.aliasCount}</td>
|
<td>{domain.aliasCount}</td>
|
||||||
<td>
|
<td>
|
||||||
<button class="danger" onclick={() => deleteDomain(domain.id)}>Delete</button>
|
<button class="danger" onclick={() => deleteDomain(domain.name)}>Delete</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/each}
|
{/each}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue