Skip to content

Commit

Permalink
Add basic auth component
Browse files Browse the repository at this point in the history
  • Loading branch information
daniellrgn committed Nov 13, 2024
1 parent 6ddabc7 commit b2488db
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/lib/components/app/Auth.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<script lang="ts">
import { getContext, onMount, setContext } from 'svelte';
import { AuthService } from '$lib/utils/AuthService';
import type { User } from 'oidc-client-ts';
let authService = getContext('authService') as AuthService;
let currentUser: User | null = null;
onMount(async () => {
if (!authService) {
authService = new AuthService();
setContext('authService', authService);
}
currentUser = await authService.getUser();
});
</script>

0 comments on commit b2488db

Please sign in to comment.