Skip to content
Snippets Groups Projects
Commit a9a87c60 authored by Guilherme Gazzo's avatar Guilherme Gazzo Committed by Diego Sampaio
Browse files

[FIX] IE11 baseURI (#15319)

parent 6ea44a36
No related branches found
No related tags found
No related merge requests found
import { FlowRouter } from 'meteor/kadira:flow-router';
import { Template } from 'meteor/templating';
import { baseURI } from '../../../utils/client/lib/baseuri';
import './icon.html';
const baseUrlFix = () => `${ document.baseURI }${ FlowRouter.current().path.substring(1) }`;
const baseUrlFix = () => `${ baseURI }${ FlowRouter.current().path.substring(1) }`;
const isMozillaFirefoxBelowVersion = (upperVersion) => {
const [, version] = navigator.userAgent.match(/Firefox\/(\d+)\.\d/) || [];
......
import { Meteor } from 'meteor/meteor';
import { Accounts } from 'meteor/accounts-base';
import { baseURI } from './baseuri';
export const APIClient = {
delete(endpoint, params) {
return APIClient._jqueryCall('DELETE', endpoint, params);
......@@ -47,7 +49,7 @@ export const APIClient = {
return new Promise(function _rlRestApiGet(resolve, reject) {
jQuery.ajax({
method,
url: `${ document.baseURI }api/${ endpoint }${ query }`,
url: `${ baseURI }api/${ endpoint }${ query }`,
headers: {
'Content-Type': 'application/json',
'X-User-Id': Meteor._localStorage.getItem(Accounts.USER_ID_KEY),
......@@ -75,7 +77,7 @@ export const APIClient = {
return new Promise(function _jqueryFormDataPromise(resolve, reject) {
jQuery.ajax({
url: `${ document.baseURI }api/${ endpoint }${ query }`,
url: `${ baseURI }api/${ endpoint }${ query }`,
headers: {
'X-User-Id': Meteor._localStorage.getItem(Accounts.USER_ID_KEY),
'X-Auth-Token': Meteor._localStorage.getItem(Accounts.LOGIN_TOKEN_KEY),
......
export const baseURI = (() => {
if (document.baseURI) { return document.baseURI; }
// Should be exactly one tag:
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
const base = document.getElementsByTagName('base');
// Return location from BASE tag.
if (base.length > 0) { return base[0].href; }
// Else use implementation of documentURI:
// http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-baseURI
return document.URL;
})();
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment