remove useless cookie redirect check
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/stores'
|
||||
import { UserService, WorkspaceService } from '$lib/gen'
|
||||
import { logout, logoutWithRedirect } from '$lib/logout'
|
||||
import { logoutWithRedirect } from '$lib/logout'
|
||||
import { superadmin, userStore, usersWorkspaceStore, workspaceStore } from '$lib/stores'
|
||||
import { getUserExt, refreshSuperadmin } from '$lib/user'
|
||||
import { sendUserToast } from '$lib/utils'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation'
|
||||
import { OpenAPI } from '$lib/gen'
|
||||
import { logout } from '$lib/logout'
|
||||
import { superadmin, userStore, usersWorkspaceStore, workspaceStore } from '$lib/stores'
|
||||
@@ -56,11 +55,6 @@
|
||||
isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent)
|
||||
//Mobile
|
||||
isCollapsed = isMobile
|
||||
if (!document.cookie.includes('token')) {
|
||||
goto('/user/login')
|
||||
} else if (!$workspaceStore) {
|
||||
goto('/user/workspaces')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
import { faSpinner } from '@fortawesome/free-solid-svg-icons'
|
||||
import { userStore, workspaceStore } from '$lib/stores'
|
||||
import { getUserExt } from '$lib/user'
|
||||
import { logoutWithRedirect } from '$lib/logout'
|
||||
|
||||
let error = $page.url.searchParams.get('error')
|
||||
let clientName = $page.params.client_name
|
||||
@@ -22,12 +23,12 @@
|
||||
}
|
||||
if (error) {
|
||||
sendUserToast(`Error trying to login with ${clientName} ${error}`, true)
|
||||
goto('/user/login')
|
||||
logoutWithRedirect(rd ?? undefined)
|
||||
} else if (code && state && clientName) {
|
||||
try {
|
||||
await UserService.loginWithOauth({ requestBody: { code, state }, clientName })
|
||||
} catch (e) {
|
||||
goto('/user/login')
|
||||
logoutWithRedirect(rd ?? undefined)
|
||||
sendUserToast(e.body ?? e.message, true)
|
||||
return
|
||||
}
|
||||
@@ -43,7 +44,7 @@
|
||||
}
|
||||
} else {
|
||||
sendUserToast('Missing code or state as query params', true)
|
||||
goto('/user/login')
|
||||
logoutWithRedirect(rd ?? undefined)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user