Loading editor/html/js/api.js +6 −4 Original line number Diff line number Diff line Loading @@ -8,13 +8,15 @@ var EditorApi = (function() { function request(method, url, data) { return new Promise(function(resolve, reject) { var xhr = new XMLHttpRequest(); xhr.open(method, url, true); // Strip the leading slash so the URL resolves against the document // <base href> (set in <head>) and honours the proxy prefix (/editor). xhr.open(method, url.replace(/^\//, ''), true); xhr.setRequestHeader('Content-Type', 'application/json'); xhr.onreadystatechange = function() { if (xhr.readyState !== 4) return; if (xhr.status === 401) { // Not authenticated — redirect to login window.location.href = '/login.html'; window.location.href = 'login.html'; return; } if (xhr.status >= 200 && xhr.status < 300) { Loading Loading @@ -45,12 +47,12 @@ var EditorApi = (function() { function requestCancellable(method, url, data) { var xhr = new XMLHttpRequest(); var promise = new Promise(function(resolve, reject) { xhr.open(method, url, true); xhr.open(method, url.replace(/^\//, ''), true); xhr.setRequestHeader('Content-Type', 'application/json'); xhr.onreadystatechange = function() { if (xhr.readyState !== 4) return; if (xhr.status === 401) { window.location.href = '/login.html'; window.location.href = 'login.html'; return; } if (xhr.status >= 200 && xhr.status < 300) { Loading editor/html/js/editor.js +2 −2 Original line number Diff line number Diff line Loading @@ -219,9 +219,9 @@ document.getElementById('btn-logout').addEventListener('click', function() { EditorApi.logout().then(function() { window.location.href = '/login.html'; window.location.href = 'login.html'; }).catch(function() { window.location.href = '/login.html'; window.location.href = 'login.html'; }); }); Loading editor/html/js/i18n.js +1 −1 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ var I18n = (function() { function load(callback) { var xhr = new XMLHttpRequest(); xhr.open('GET', '/api/i18n', true); xhr.open('GET', 'api/i18n', true); xhr.onreadystatechange = function() { if (xhr.readyState !== 4) return; if (xhr.status === 200) { Loading editor/html/js/preview.js +1 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ var Preview = (function() { function refresh() { // Fetch render data (blogUrl, authid, html) then POST directly // to the blog's /render endpoint inside the iframe. fetch('/api/preview/page') fetch('api/preview/page') .then(function(r) { return r.json(); }) .then(function(data) { if (data.error) { Loading Loading
editor/html/js/api.js +6 −4 Original line number Diff line number Diff line Loading @@ -8,13 +8,15 @@ var EditorApi = (function() { function request(method, url, data) { return new Promise(function(resolve, reject) { var xhr = new XMLHttpRequest(); xhr.open(method, url, true); // Strip the leading slash so the URL resolves against the document // <base href> (set in <head>) and honours the proxy prefix (/editor). xhr.open(method, url.replace(/^\//, ''), true); xhr.setRequestHeader('Content-Type', 'application/json'); xhr.onreadystatechange = function() { if (xhr.readyState !== 4) return; if (xhr.status === 401) { // Not authenticated — redirect to login window.location.href = '/login.html'; window.location.href = 'login.html'; return; } if (xhr.status >= 200 && xhr.status < 300) { Loading Loading @@ -45,12 +47,12 @@ var EditorApi = (function() { function requestCancellable(method, url, data) { var xhr = new XMLHttpRequest(); var promise = new Promise(function(resolve, reject) { xhr.open(method, url, true); xhr.open(method, url.replace(/^\//, ''), true); xhr.setRequestHeader('Content-Type', 'application/json'); xhr.onreadystatechange = function() { if (xhr.readyState !== 4) return; if (xhr.status === 401) { window.location.href = '/login.html'; window.location.href = 'login.html'; return; } if (xhr.status >= 200 && xhr.status < 300) { Loading
editor/html/js/editor.js +2 −2 Original line number Diff line number Diff line Loading @@ -219,9 +219,9 @@ document.getElementById('btn-logout').addEventListener('click', function() { EditorApi.logout().then(function() { window.location.href = '/login.html'; window.location.href = 'login.html'; }).catch(function() { window.location.href = '/login.html'; window.location.href = 'login.html'; }); }); Loading
editor/html/js/i18n.js +1 −1 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ var I18n = (function() { function load(callback) { var xhr = new XMLHttpRequest(); xhr.open('GET', '/api/i18n', true); xhr.open('GET', 'api/i18n', true); xhr.onreadystatechange = function() { if (xhr.readyState !== 4) return; if (xhr.status === 200) { Loading
editor/html/js/preview.js +1 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ var Preview = (function() { function refresh() { // Fetch render data (blogUrl, authid, html) then POST directly // to the blog's /render endpoint inside the iframe. fetch('/api/preview/page') fetch('api/preview/page') .then(function(r) { return r.json(); }) .then(function(data) { if (data.error) { Loading