Skip to content

Commit

Permalink
Merge branch 'newscorpaus-feature/configure-cross-domain'
Browse files Browse the repository at this point in the history
  • Loading branch information
philipjohn committed Jun 5, 2018
2 parents de1ddcf + beda723 commit 1fcc12e
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 6 deletions.
2 changes: 1 addition & 1 deletion assets/amp.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 21 additions & 5 deletions assets/app.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions liveblog.php
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,7 @@ public static function enqueue_scripts() {

'use_rest_api' => intval( self::use_rest_api() ),
'endpoint_url' => self::get_entries_endpoint_url(),
'cross_domain' => false,

'features' => WPCOM_Liveblog_Entry_Extend::get_enabled_features(),
'autocomplete' => WPCOM_Liveblog_Entry_Extend::get_autocomplete(),
Expand Down
11 changes: 11 additions & 0 deletions src/react/services/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export function getEntries(page, config, newestEntry) {
const settings = {
url: `${config.endpoint_url}get-entries/${page}/${newestEntry.id || config.latest_entry_id}-${newestEntry.timestamp || config.latest_entry_timestamp}`,
method: 'GET',
crossDomain: config.cross_domain,
};

return ajax(settings);
Expand All @@ -25,6 +26,7 @@ export function polling(newestEntryTimestamp, config) {
const settings = {
url: `${config.endpoint_url}entries/${(newestEntryTimestamp + 1) || 0}/${timestamp}/`,
method: 'GET',
crossDomain: config.cross_domain,
};

return ajax(settings);
Expand All @@ -46,6 +48,7 @@ export function createEntry(entry, config, nonce = false) {
'X-WP-Nonce': nonce || config.nonce,
'cache-control': 'no-cache',
},
crossDomain: config.cross_domain,
};

return ajax(settings);
Expand All @@ -68,6 +71,7 @@ export function updateEntry(entry, config, nonce = false) {
'X-WP-Nonce': nonce || config.nonce,
'cache-control': 'no-cache',
},
crossDomain: config.cross_domain,
};

return ajax(settings);
Expand All @@ -87,6 +91,7 @@ export function deleteEntry(id, config, nonce = false) {
'X-WP-Nonce': nonce || config.nonce,
'cache-control': 'no-cache',
},
crossDomain: config.cross_domain,
};

return ajax(settings);
Expand All @@ -95,6 +100,7 @@ export function deleteEntry(id, config, nonce = false) {
export function getEvents(config, newestEntry) {
const settings = {
url: `${config.endpoint_url}get-key-events/${newestEntry.id || config.latest_entry_id}-${newestEntry.timestamp || config.latest_entry_timestamp}`,
crossDomain: config.cross_domain,
method: 'GET',
};

Expand All @@ -104,6 +110,7 @@ export function getEvents(config, newestEntry) {
export function jumpToEvent(id, config, newestEntry) {
const settings = {
url: `${config.endpoint_url}jump-to-key-event/${id}/${newestEntry.id || 0}-${newestEntry.timestamp || 0}`,
crossDomain: config.cross_domain,
method: 'GET',
};

Expand All @@ -125,6 +132,7 @@ export function deleteEvent(entry, config, nonce = false) {
'X-WP-Nonce': nonce || config.nonce,
'cache-control': 'no-cache',
},
crossDomain: config.cross_domain,
};

return ajax(settings);
Expand All @@ -134,6 +142,7 @@ export function getAuthors(term, config) {
const settings = {
url: `${config.autocomplete[3].url}${term}`,
method: 'GET',
crossDomain: config.cross_domain,
};

return ajax(settings);
Expand All @@ -143,6 +152,7 @@ export function getHashtags(term, config) {
const settings = {
url: `${config.autocomplete[2].url}${term}`,
method: 'GET',
crossDomain: config.cross_domain,
};

return ajax(settings);
Expand All @@ -158,6 +168,7 @@ export function getPreview(content, config) {
headers: {
'Content-Type': 'application/json',
},
crossDomain: config.cross_domain,
};

return ajax(settings);
Expand Down

0 comments on commit 1fcc12e

Please sign in to comment.