implemented unlinking of oidc connection
This commit is contained in:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user