2023-05-16 10:57:07 +02:00

20 lines
359 B
JavaScript
Executable File

const openWithNewTab = (path) => {
const url = (() => {
if (path.startsWith('/')) {
return `${window.strapi.backendURL}${path}`;
}
if (path.startsWith('http')) {
return path;
}
return `${window.strapi.backendURL}/${path}`;
})();
window.open(url, '_blank');
return window.focus();
};
export default openWithNewTab;