From 7546055e639c833e1edda1af83d1fc687fa0dea2 Mon Sep 17 00:00:00 2001 From: Gabrielle von Koss Date: Wed, 6 Sep 2017 17:29:19 +0100 Subject: [PATCH] =?UTF-8?q?update=20host=20because=20CORS=20=20?= =?UTF-8?q?=F0=9F=90=BF=20v2.5.16?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/n-ui/typeahead/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/n-ui/typeahead/index.js b/components/n-ui/typeahead/index.js index ade82cdbf..8d1c5e0c4 100644 --- a/components/n-ui/typeahead/index.js +++ b/components/n-ui/typeahead/index.js @@ -4,6 +4,7 @@ import { SuggestionList } from './suggestion-list'; const React = require('react'); const ReactDom = require('react-dom'); +const host = /local(?:host)?\.ft\.com/.test(window.location.host) ? window.location.host : 'www.ft.com'; function getNonMatcher (container) { if (typeof container === 'string') { @@ -32,7 +33,7 @@ class Typeahead { this.container = containerEl; this.listComponent = listComponent || SuggestionList; this.searchEl = this.container.querySelector('[data-typeahead-input]'); - this.dataSrc = `//${window.location.host}/search-api/suggestions?partial=`; + this.dataSrc = `//${host}/search-api/suggestions?partial=`; this.categories = (this.container.getAttribute('data-typeahead-categories') || 'tags').split(','); this.itemTag = this.container.getAttribute('data-typeahead-item-tag') || 'a'; this.includeViewAllLink = this.container.hasAttribute('data-typeahead-view-all');