preparing for deletion of company
This commit is contained in:
@@ -28,6 +28,21 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function drop(company){
|
||||
if (!confirm(t('confirm_delete',{element:company.name}))) return;
|
||||
const url = api(`company/${company.id}`);
|
||||
const resp = await fetch(url,{
|
||||
credentials : 'include',
|
||||
method : 'DELETE'
|
||||
});
|
||||
if (resp.ok){
|
||||
delete companies[company.id];
|
||||
error = null;
|
||||
} else {
|
||||
error = await resp.text();
|
||||
}
|
||||
}
|
||||
|
||||
async function loadCompanies(){
|
||||
const url = api('company/list');
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
@@ -64,7 +79,10 @@
|
||||
{t('email')}
|
||||
</th>
|
||||
<th>
|
||||
{t('detail')}
|
||||
{t('members')}
|
||||
</th>
|
||||
<th>
|
||||
{t('actions')}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -76,6 +94,7 @@
|
||||
<td>
|
||||
<input type="email" bind:value={new_company.email} />
|
||||
</td>
|
||||
<td></td>
|
||||
<td>
|
||||
<button disabled={missing_fields} onclick={create_company}>{t('create_new_object',{object:t('company')})}</button>
|
||||
</td>
|
||||
@@ -91,6 +110,9 @@
|
||||
{/each}
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<button onclick={e => drop(company)}>{t('delete_object',{object:t('company')})}</button>
|
||||
</td>
|
||||
</tr>
|
||||
{#if selected==cid}
|
||||
<tr>
|
||||
|
||||
Reference in New Issue
Block a user