🚸 (bot) Show a popup when the redirect is blocked by browser

Allows us to show a link button to redirect the user anyway
This commit is contained in:
Baptiste Arnaud
2023-02-20 08:36:48 +01:00
parent e6ec84b77b
commit b2d1235f1b
9 changed files with 148 additions and 34 deletions

View File

@@ -1,6 +1,13 @@
import type { RedirectOptions } from 'models'
export const executeRedirect = ({ url, isNewTab }: RedirectOptions) => {
export const executeRedirect = ({
url,
isNewTab,
}: RedirectOptions): { blockedPopupUrl: string } | undefined => {
if (!url) return
window.open(url, isNewTab ? '_blank' : '_self')
const updatedWindow = window.open(url, isNewTab ? '_blank' : '_self')
if (!updatedWindow)
return {
blockedPopupUrl: url,
}
}