svelte-oidc/src/components/LogoutButton.svelte
Chris Hickingbottom 0b85df2619
Update LogoutButton to all customizable style designs
Added classes and styles attributes that allow the button to be styled by the developer.
2023-01-20 11:57:03 -06:00

15 lines
559 B
Svelte

<script>
import { getContext } from 'svelte';
import {
OIDC_CONTEXT_CLIENT_PROMISE,
OIDC_CONTEXT_POST_LOGOUT_REDIRECT_URI,
logout,
} from './OidcContext.svelte';
const oidcPromise = getContext(OIDC_CONTEXT_CLIENT_PROMISE)
export let logout_url = getContext(OIDC_CONTEXT_POST_LOGOUT_REDIRECT_URI)
export let classes = ''
export let styles = ''
</script>
<button class="btn {classes}" style="{styles} on:click|preventDefault='{() => logout(oidcPromise, logout_url) }'><slot></slot></button>