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