This commit is contained in:
@@ -150,16 +150,22 @@ export default {
|
|||||||
return Promise.resolve(response);
|
return Promise.resolve(response);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
json(response) {
|
extractBody(response) {
|
||||||
if (response.status == 204) {
|
if (response.status == 204) {
|
||||||
//no content, nothing to process
|
//no content, nothing to process
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
let contentType = response.headers.get("content-type");
|
let contentType = response.headers.get("content-type");
|
||||||
|
if (!contentType) {
|
||||||
|
return response;
|
||||||
|
}
|
||||||
// console.log("gzapi::JSON method, content type is:", contentType);
|
// console.log("gzapi::JSON method, content type is:", contentType);
|
||||||
if (contentType && contentType.includes("json")) {
|
if (contentType.includes("json")) {
|
||||||
return response.json();
|
return response.json();
|
||||||
}
|
}
|
||||||
|
if (contentType.includes("text/plain")) {
|
||||||
|
return response.text();
|
||||||
|
}
|
||||||
return response;
|
return response;
|
||||||
},
|
},
|
||||||
apiErrorToHumanString(apiError) {
|
apiErrorToHumanString(apiError) {
|
||||||
@@ -348,7 +354,7 @@ export default {
|
|||||||
return new Promise(function getDataFromServer(resolve, reject) {
|
return new Promise(function getDataFromServer(resolve, reject) {
|
||||||
fetch(that.APIUrl(route), that.fetchGetOptions())
|
fetch(that.APIUrl(route), that.fetchGetOptions())
|
||||||
.then(that.status)
|
.then(that.status)
|
||||||
.then(that.json)
|
.then(that.extractBody)
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
resolve(response);
|
resolve(response);
|
||||||
@@ -380,7 +386,7 @@ export default {
|
|||||||
}
|
}
|
||||||
fetch(that.APIUrl(route), fetchOptions)
|
fetch(that.APIUrl(route), fetchOptions)
|
||||||
.then(that.status)
|
.then(that.status)
|
||||||
.then(that.json)
|
.then(that.extractBody)
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
//Note: response.error indicates there is an error, however this is not an unusual condition
|
//Note: response.error indicates there is an error, however this is not an unusual condition
|
||||||
@@ -401,7 +407,7 @@ export default {
|
|||||||
return new Promise(function removeDataFromServer(resolve, reject) {
|
return new Promise(function removeDataFromServer(resolve, reject) {
|
||||||
fetch(that.APIUrl(route), that.fetchRemoveOptions())
|
fetch(that.APIUrl(route), that.fetchRemoveOptions())
|
||||||
.then(that.status)
|
.then(that.status)
|
||||||
//.then(that.json)
|
//.then(that.extractBody)
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
resolve(response);
|
resolve(response);
|
||||||
@@ -420,7 +426,7 @@ export default {
|
|||||||
return new Promise(function duplicateRecordOnServer(resolve, reject) {
|
return new Promise(function duplicateRecordOnServer(resolve, reject) {
|
||||||
fetch(that.APIUrl(route), that.fetchPostOptions(null))
|
fetch(that.APIUrl(route), that.fetchPostOptions(null))
|
||||||
.then(that.status)
|
.then(that.status)
|
||||||
.then(that.json)
|
.then(that.extractBody)
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
//Note: response.error indicates there is an error, however this is not an unusual condition
|
//Note: response.error indicates there is an error, however this is not an unusual condition
|
||||||
@@ -465,7 +471,7 @@ export default {
|
|||||||
|
|
||||||
fetch(that.APIUrl("attachment"), fetchOptions)
|
fetch(that.APIUrl("attachment"), fetchOptions)
|
||||||
.then(that.status)
|
.then(that.status)
|
||||||
.then(that.json)
|
.then(that.extractBody)
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
resolve(response);
|
resolve(response);
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export default {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
vm.formState.ready = true;
|
vm.formState.ready = true;
|
||||||
window.$gz.eventBus.$on("menu-click", clickHandler);
|
window.$gz.eventBus.$on("menu-click", clickHandler);
|
||||||
// vm.getDataFromApi();
|
|
||||||
vm.formState.loading = false;
|
vm.formState.loading = false;
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
@@ -47,7 +47,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
log: [],
|
log: null,
|
||||||
selectedLog: null,
|
selectedLog: null,
|
||||||
selectLists: {
|
selectLists: {
|
||||||
serverLogs: []
|
serverLogs: []
|
||||||
@@ -106,10 +106,10 @@ export default {
|
|||||||
vm.formState.serverError = res.error;
|
vm.formState.serverError = res.error;
|
||||||
window.$gz.form.setErrorBoxErrors(vm);
|
window.$gz.form.setErrorBoxErrors(vm);
|
||||||
} else {
|
} else {
|
||||||
if (res.data) {
|
if (res) {
|
||||||
vm.log = res.data;
|
vm.log = res;
|
||||||
} else {
|
} else {
|
||||||
vm.log = null;
|
vm.log = vm.$ay.t("NoData");
|
||||||
}
|
}
|
||||||
|
|
||||||
window.$gz.form.setFormState({
|
window.$gz.form.setFormState({
|
||||||
|
|||||||
Reference in New Issue
Block a user