diff --git a/static/src/index.js b/static/src/index.js index 80d4615..8d65322 100644 --- a/static/src/index.js +++ b/static/src/index.js @@ -30,7 +30,7 @@ export default class BaseComponent extends Component { } componentDidMount() { - fetch('/api/v1/info') + fetch('/api/v1/info', {credentials: 'include'}) .then(d => d.json()) .then(info => this.setState({ info })) .then(() => this.checkAuth()) @@ -42,6 +42,7 @@ export default class BaseComponent extends Component { if (token) { fetch('/api/v1/auth/check', { method: 'POST', + credentials: 'include', body: JSON.stringify({ Token: token }), diff --git a/static/src/util/util.js b/static/src/util/util.js index 55a2886..71b9dc8 100644 --- a/static/src/util/util.js +++ b/static/src/util/util.js @@ -2,7 +2,7 @@ import toastr from 'toastr' export default class UtilHelper { static deleteEntry(url, cb) { - fetch(url) + fetch(url, {credentials: "include"}) .then(res => res.ok ? res.json() : Promise.reject(res.json())) .then(cb()) .catch(e => this._reportError(e, "delete entry")) @@ -10,6 +10,7 @@ export default class UtilHelper { static _constructFetch(url, body, cbSucc, cbErr) { fetch(url, { method: "POST", + credentials: "include", body: JSON.stringify(body), headers: { 'Authorization': window.localStorage.getItem('token'), @@ -45,6 +46,7 @@ export default class UtilHelper { } static getRecentURLs(cbSucc) { fetch('/api/v1/protected/recent', { + credentials: "include", headers: { 'Authorization': window.localStorage.getItem('token'), 'Content-Type': 'application/json' @@ -54,4 +56,4 @@ export default class UtilHelper { .then(res => cbSucc ? cbSucc(res) : null) .catch(e => this._reportError(e, "recent")) } -} \ No newline at end of file +}