mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-12 00:06:14 +00:00
window openeer nits
This commit is contained in:
@@ -14,7 +14,8 @@
|
||||
|
||||
onMount(async () => {
|
||||
if (error) {
|
||||
window.opener.postMessage(
|
||||
sendUserToast(`Error trying to add ${client_name} connection: ${error}`, true)
|
||||
window.opener?.postMessage(
|
||||
{ type: 'error', error: `Error trying to add ${client_name} connection: ${error}` },
|
||||
'*'
|
||||
)
|
||||
@@ -26,17 +27,19 @@
|
||||
requestBody: { code, state }
|
||||
})
|
||||
sendUserToast('successful', false)
|
||||
window.opener.postMessage({ type: 'success', res, resource_type: client_name }, '*')
|
||||
window.opener?.postMessage({ type: 'success', res, resource_type: client_name }, '*')
|
||||
// goto(`/resources?resource_type=${client_name}`)
|
||||
} catch (e) {
|
||||
window.opener.postMessage(
|
||||
sendUserToast(`Error trying to add ${client_name} connection: ${e.body}`, true)
|
||||
window.opener?.postMessage(
|
||||
{ type: 'error', error: `Error parsing the response token, ${e.body}` },
|
||||
'*'
|
||||
)
|
||||
// goto('/resources')
|
||||
}
|
||||
} else {
|
||||
window.opener.postMessage(
|
||||
sendUserToast('Missing code or state as query params', true)
|
||||
window.opener?.postMessage(
|
||||
{ type: 'error', error: 'Missing code or state as query params' },
|
||||
'*'
|
||||
)
|
||||
|
||||
@@ -45,8 +45,12 @@
|
||||
|
||||
if (rd?.startsWith('http')) {
|
||||
if (closeUponLogin) {
|
||||
window.opener.postMessage({ type: 'success' }, '*')
|
||||
window.close()
|
||||
if (window.opener) {
|
||||
window.opener.postMessage({ type: 'success' }, '*')
|
||||
window.close()
|
||||
} else {
|
||||
sendUserToast(`Logged in successfully, but can't communicate with main page. Close this window and refresh main page.`, false)
|
||||
}
|
||||
return
|
||||
}
|
||||
window.location.href = rd
|
||||
@@ -72,8 +76,12 @@
|
||||
if (allWorkspaces?.length == 1) {
|
||||
$workspaceStore = allWorkspaces[0].id
|
||||
if (closeUponLogin) {
|
||||
window.opener.postMessage({ type: 'success' }, '*')
|
||||
window.close()
|
||||
if (window.opener) {
|
||||
window.opener.postMessage({ type: 'success' }, '*')
|
||||
window.close()
|
||||
} else {
|
||||
sendUserToast(`Logged in successfully, but can't communicate with main page. Close this window and refresh main page.`, false)
|
||||
}
|
||||
return
|
||||
}
|
||||
if (rd) {
|
||||
|
||||
Reference in New Issue
Block a user