1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-04 03:00:05 +00:00

chore(redirectLogin): onLoggedOut callback should be an async

This commit is contained in:
Saad Jutt
2021-09-02 13:43:07 +05:00
parent f231edb4a6
commit f40a86f0f6
4 changed files with 17 additions and 120 deletions

View File

@@ -9,7 +9,7 @@ export async function openWebPage(
url: string,
windowName: string = '',
{ width, height }: windowFeatures,
onLoggedOut?: Function
onLoggedOut?: () => Promise<Boolean>
): Promise<Window | null> {
const left = screen.width / 2 - width / 2
const top = screen.height / 2 - height / 2
@@ -21,12 +21,9 @@ export async function openWebPage(
)
if (!loginPopup) {
if (onLoggedOut) {
onLoggedOut()
return null
}
const getUserAction: () => Promise<Boolean> = onLoggedOut ?? openLoginPrompt
const doLogin = await openLoginPrompt()
const doLogin = await getUserAction()
return doLogin
? window.open(
url,