Skip to content

Commit

Permalink
Merge pull request #48 from nypublicradio/point-to-api
Browse files Browse the repository at this point in the history
point data requests to wnycAPI
  • Loading branch information
Brian Whitton authored Jan 31, 2017
2 parents 87c7335 + 7956ce1 commit 2be3a55
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions app/discover/stories/adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ import DS from 'ember-data';
import service from 'ember-service/inject';

const { featureFlags } = ENV;
const host = featureFlags['other-discover'] ? ENV.wnycAPI : ENV.wnycURL;
const path = featureFlags['other-discover'] ? 'reco_proxy' : 'make_playlist';

export default DS.JSONAPIAdapter.extend({
host,
host: ENV.wnycAPI,
namespace: `api/v3/${path}/`,
session: service(),

Expand Down
2 changes: 1 addition & 1 deletion app/services/script-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function scriptURL(tag) {
if (url.indexOf(origin) === 0) {
return url;
} else {
return `/api/v1/dynamic-script-loader/?url=${encodeURIComponent(canonicalize(url))}`;
return `${ENV.wnycAPI}/api/v1/dynamic-script-loader/?url=${encodeURIComponent(canonicalize(url))}`;
}
}

Expand Down
6 changes: 3 additions & 3 deletions app/services/whats-on.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import Service from 'ember-service';
import get from 'ember-metal/get';
import { canonicalize } from 'wnyc-web-client/services/script-loader';

let { wnycURL } = ENV;
wnycURL = canonicalize(wnycURL);
let { wnycAPI } = ENV;
wnycAPI = canonicalize(wnycAPI);

export default Service.extend({
endPoint: 'api/v1/whats_on/',
isLive(pk) {
let endPoint = get(this, 'endPoint');
let url = `${wnycURL}${endPoint}`;
let url = `${wnycAPI}${endPoint}`;

return $.ajax(url).then(d => this._extractStatus(d, pk));
},
Expand Down
2 changes: 1 addition & 1 deletion mirage/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default function() {
this.get(`${baseUrl}/api/v3/channel/\*id`, 'api-response');

let discoverPath = config.featureFlags['other-discover'] ? 'reco_proxy' : 'make_playlist';
this.get(`${baseUrl}/api/v3/${discoverPath}`, function(schema) {
this.get(`${config.wnycAPI}/api/v3/${discoverPath}`, function(schema) {
let stories = schema.discoverStories.all().models;

let data = stories.map(s => {
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/discover-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ skip('playlist request sends stories and tags in correct format', function(asser
andThen(() => {
click($('button:contains("Create Playlist")'));
//
let url =[ENV.wnycURL, 'api/v3/make_playlist'].join("/");
let url =[ENV.wnycAPI, 'api/v3/make_playlist'].join("/");

server.get(url, function(schema, request) {

Expand Down

0 comments on commit 2be3a55

Please sign in to comment.