Merge pull request #258 from mcclurec/sso-compliant-fetch-calls

SSO Compliant Fetch Calls
This commit is contained in:
Bastien Wirtz 2021-09-13 12:55:14 -07:00 committed by GitHub
commit afe6d34ced
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 3 deletions

View File

@ -51,7 +51,9 @@ export default {
},
methods: {
fetchStatus: async function () {
this.status = await fetch(`${this.item.url}/control/status`).then(
this.status = await fetch(`${this.item.url}/control/status`, {
credentials: "include",
}).then(
(response) => response.json()
);
},

View File

@ -59,6 +59,7 @@ export default {
}
const url = `${this.item.url}/api/documents/`;
this.api = await fetch(url, {
credentials: "include",
headers: {
Authorization: "Token " + this.item.apikey,
},

View File

@ -64,7 +64,9 @@ export default {
methods: {
fetchStatus: async function () {
const url = `${this.item.url}/api.php`;
this.api = await fetch(url)
this.api = await fetch(url, {
credentials: "include",
})
.then((response) => response.json())
.catch((e) => console.log(e));
},

View File

@ -50,7 +50,11 @@ export default {
methods: {
fetchStatus: async function () {
const url = `${this.item.url}`;
fetch(url, { method: "HEAD", cache: "no-cache" })
fetch(url, {
method: "HEAD",
cache: "no-cache",
credentials: "include",
})
.then((response) => {
if (!response.ok) {
throw Error(response.statusText);