nit redirect on logout

This commit is contained in:
Ruben Fiszel
2022-12-27 13:38:34 +01:00
parent 8c268ff34b
commit 4e1e80e673
2 changed files with 5 additions and 3 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ export async function logout(): Promise<void> {
sendUserToast('you have been logged out')
}
async function clearUser() {
export async function clearUser() {
try {
clearStores()
await UserService.logout()
@@ -1,14 +1,16 @@
<script lang="ts">
import { goto } from '$app/navigation'
import { page } from '$app/stores'
import CenteredModal from '$lib/components/CenteredModal.svelte'
import WindmillIcon from '$lib/components/icons/WindmillIcon.svelte'
import { logoutWithRedirect } from '$lib/logout'
import { clearUser, logoutWithRedirect } from '$lib/logout'
import { onMount } from 'svelte'
const rd = $page.url.searchParams.get('rd')
onMount(async () => {
await logoutWithRedirect(rd ?? undefined)
await clearUser()
goto(rd ?? '/user/login')
})
</script>