|
|
|
|
@ -1,27 +1,16 @@
@@ -1,27 +1,16 @@
|
|
|
|
|
<script> |
|
|
|
|
import { onMount } from 'svelte'; |
|
|
|
|
import { t } from '../../translations.svelte.js'; |
|
|
|
|
import { useTinyRouter } from 'svelte-tiny-router'; |
|
|
|
|
|
|
|
|
|
import { api } from '../../urls.svelte.js'; |
|
|
|
|
import { t } from '../../translations.svelte.js'; |
|
|
|
|
import { user } from '../../user.svelte.js'; |
|
|
|
|
|
|
|
|
|
const router = useTinyRouter(); |
|
|
|
|
|
|
|
|
|
let services = $state([]); |
|
|
|
|
|
|
|
|
|
async function loadButtons(){ |
|
|
|
|
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/oidc/buttons`; |
|
|
|
|
const resp = await fetch(url,{credentials:'include'}); |
|
|
|
|
if (resp.ok){ |
|
|
|
|
const json = await resp.json(); |
|
|
|
|
while (services.length) services.pop(); |
|
|
|
|
for (let service of json) services.push(service); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
onMount(loadButtons); |
|
|
|
|
|
|
|
|
|
async function connect(service){ |
|
|
|
|
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/oidc/redirect/${service}`; |
|
|
|
|
const url = api(`user/oidc/redirect/${service}`); |
|
|
|
|
const resp = await fetch(url,{credentials:'include'}); |
|
|
|
|
if (resp.ok){ |
|
|
|
|
var json = await resp.json(); |
|
|
|
|
@ -33,14 +22,26 @@
@@ -33,14 +22,26 @@
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async function loadButtons(){ |
|
|
|
|
const url = api(`user/oidc/buttons`); |
|
|
|
|
const resp = await fetch(url,{credentials:'include'}); |
|
|
|
|
if (resp.ok){ |
|
|
|
|
const json = await resp.json(); |
|
|
|
|
while (services.length) services.pop(); |
|
|
|
|
for (let service of json) services.push(service); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async function drop(service){ |
|
|
|
|
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/oidc/${service}`; |
|
|
|
|
const url = api(`user/oidc/${service}`); |
|
|
|
|
const resp = await fetch(url,{ |
|
|
|
|
credentials : 'include', |
|
|
|
|
method : 'DELETE' |
|
|
|
|
}); |
|
|
|
|
if (resp.ok) loadButtons(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
onMount(loadButtons); |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<fieldset tabindex="0"> |
|
|
|
|
|