mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-20 16:02:19 +00:00
fix redirect at login
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/stores'
|
||||
import { UserService } from '$lib/gen'
|
||||
import { get } from 'svelte/store'
|
||||
import { clearStores } from './stores.js'
|
||||
import { sendUserToast } from './utils.js'
|
||||
|
||||
@@ -9,7 +7,7 @@ function clearCookies() {
|
||||
document.cookie.split(";").forEach(function (c) { document.cookie = c.replace(/^ +/, "").replace(/=.*/, "=;expires=" + new Date().toUTCString() + ";path=/") })
|
||||
}
|
||||
export function logoutWithRedirect(rd?: string): void {
|
||||
if (get(page).url.pathname != '/user/login') {
|
||||
if (rd?.split('?')[0] != '/user/login') {
|
||||
const error = document.cookie.includes('token')
|
||||
? `error=${encodeURIComponent('You have been logged out because your session has expired.')}&`
|
||||
: ''
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
if ($workspaceStore) {
|
||||
goto(rd ?? '/')
|
||||
} else {
|
||||
goto('/user/workspaces')
|
||||
goto(`/user/workspaces${rd ? `?rd=${encodeURIComponent(rd)}` : ''}`)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user