| 1 |
export default function useAction() { |
| 2 |
return { |
| 3 |
backToDashboard: () => { |
| 4 |
if ( window.top === window ) { |
| 5 |
window.top.location = elementorAppConfig.admin_url; |
| 6 |
} else { |
| 7 |
// Iframe. |
| 8 |
window.top.$e.run( 'app/close' ); |
| 9 |
} |
| 10 |
}, |
| 11 |
backToReferrer: () => { |
| 12 |
if ( window.top === window ) { |
| 13 |
// Directly - in case that the return_url is the login-page, the target should be the admin-page and not the login-page again. |
| 14 |
window.top.location = elementorAppConfig.return_url.includes( elementorAppConfig.login_url ) ? elementorAppConfig.admin_url : elementorAppConfig.return_url; |
| 15 |
} else { |
| 16 |
// Iframe. |
| 17 |
window.top.$e.run( 'app/close' ); |
| 18 |
} |
| 19 |
}, |
| 20 |
}; |
| 21 |
} |
| 22 |
|