[FIX] odoo_theme: stop testing for valid URLs if in localhost
The mechanism that makes the version and language switchers test for valid URLs crashed when testing in localhost. The mechanism is now skipped if the URL starts with a '/'.
This commit is contained in:
parent
3fd32fe92a
commit
98e98f65c9
@ -15,10 +15,13 @@
|
|||||||
document.querySelectorAll('a[class="dropdown-item"]').forEach(element => {
|
document.querySelectorAll('a[class="dropdown-item"]').forEach(element => {
|
||||||
element.addEventListener('click', async event => {
|
element.addEventListener('click', async event => {
|
||||||
if (element.hasAttribute('href')) {
|
if (element.hasAttribute('href')) {
|
||||||
event.preventDefault();
|
const targetUrl = element.getAttribute('href');
|
||||||
const fallbackUrls = await _generateFallbackUrls(element.getAttribute('href'));
|
if (!targetUrl.startWith('/')) { // Don't test for valid URLs if in localhost.
|
||||||
const fallbackUrl = await _getFirstValidUrl(fallbackUrls);
|
event.preventDefault();
|
||||||
window.location.href = fallbackUrl;
|
const fallbackUrls = await _generateFallbackUrls(targetUrl);
|
||||||
|
const fallbackUrl = await _getFirstValidUrl(fallbackUrls);
|
||||||
|
window.location.href = fallbackUrl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user