implemented unlinking of oidc connection

This commit is contained in:
2025-07-03 19:13:38 +02:00
parent 41c3ffa351
commit 695714f4eb
2 changed files with 69 additions and 4 deletions

View File

@@ -5,7 +5,7 @@
let connections = $state([]);
onMount(async () => {
async function loadConnections(){
let url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/oidc/connected`;
let resp = await fetch(url,{credentials:'include'});
@@ -16,7 +16,23 @@
console.log(entry);
}
}
});
}
onMount(loadConnections);
async function unlink(connection){
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/oidc/connected`;
const resp = fetch(url,{
method: 'DELETE',
credentials: 'include',
body: JSON.stringify(connection)
});
if (resp.ok){
alert('succeeded');
} else {
alert('failed');
}
}
</script>
{#if connections.length>0}
@@ -36,7 +52,7 @@
<td>{connection.service_id}</td>
<td>{connection.foreign_id}</td>
<td>
<button>{t('user.unlink')}</button>
<button onclick={() => unlink(connection)}>{t('user.unlink')}</button>
</td>
</tr>
{/each}