Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 34x | const absoluteUrl = path => { let absolutePath = '/'; Iif (!path) { return absolutePath; } // TODO: Find another way to get root url const absoluteUrl = window.location.origin; const absoluteUrlParts = absoluteUrl.split('/'); if (absoluteUrlParts.length > 4) { const rootUrlPrefixIndex = absoluteUrl.indexOf(absoluteUrlParts[3]); absolutePath += absoluteUrl.substring(rootUrlPrefixIndex) + path; } else { absolutePath += path; } return absolutePath.replace(/\/\/+/g, '/'); }; export default absoluteUrl; |