mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-23 08:00:45 +00:00
fix login bug
This commit is contained in:
@@ -31,15 +31,6 @@
|
||||
'Connection got disposed.'
|
||||
]
|
||||
|
||||
async function redirectIfLoggedIn(): Promise<void> {
|
||||
try {
|
||||
await UserService.getCurrentEmail()
|
||||
goto('/')
|
||||
} catch {
|
||||
clearStores()
|
||||
}
|
||||
}
|
||||
|
||||
async function loadData() {
|
||||
try {
|
||||
$usersWorkspaceStore = await WorkspaceService.listUserWorkspaces()
|
||||
@@ -57,16 +48,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function handleRedirectionsAndLoadData() {
|
||||
if ($page.url.pathname === '/user/login') {
|
||||
redirectIfLoggedIn()
|
||||
} else {
|
||||
loadData()
|
||||
}
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
handleRedirectionsAndLoadData()
|
||||
loadData()
|
||||
|
||||
window.onunhandledrejection = (event: PromiseRejectionEvent) => {
|
||||
event.preventDefault()
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/stores'
|
||||
import { faGithub } from '@fortawesome/free-brands-svg-icons'
|
||||
import { onMount } from 'svelte'
|
||||
import Icon from 'svelte-awesome'
|
||||
import { slide } from 'svelte/transition'
|
||||
import { UserService, WorkspaceService } from '../../gen'
|
||||
import { userStore, usersWorkspaceStore, workspaceStore } from '../../stores'
|
||||
import { clearStores, userStore, usersWorkspaceStore, workspaceStore } from '../../stores'
|
||||
import { getUser, refreshSuperadmin, sendUserToast } from '../../utils'
|
||||
import CenteredModal from './CenteredModal.svelte'
|
||||
|
||||
@@ -42,6 +43,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
onMount(async () => {
|
||||
try {
|
||||
await UserService.getCurrentEmail()
|
||||
goto('/')
|
||||
} catch {
|
||||
clearStores()
|
||||
}
|
||||
})
|
||||
|
||||
function handleKeyUp(event: KeyboardEvent) {
|
||||
const key = event.key || event.keyCode
|
||||
|
||||
|
||||
Reference in New Issue
Block a user