This commit is contained in:
@@ -6,7 +6,7 @@ function addDataKeyNames(obj) {
|
|||||||
//iterate the array of objects
|
//iterate the array of objects
|
||||||
//if it has a "type" property then it's a custom field so add its data key name
|
//if it has a "type" property then it's a custom field so add its data key name
|
||||||
|
|
||||||
for (var i = 0; i < obj.length; i++) {
|
for (let i = 0; i < obj.length; i++) {
|
||||||
if (obj[i].type) {
|
if (obj[i].type) {
|
||||||
obj[i]["dataKey"] = "c" + parseInt(obj[i].fld.replace(/^\D+/g, ""));
|
obj[i]["dataKey"] = "c" + parseInt(obj[i].fld.replace(/^\D+/g, ""));
|
||||||
}
|
}
|
||||||
@@ -56,7 +56,7 @@ export default {
|
|||||||
"]";
|
"]";
|
||||||
}
|
}
|
||||||
|
|
||||||
var template = window.$gz.store.state.formCustomTemplate[formKey];
|
let template = window.$gz.store.state.formCustomTemplate[formKey];
|
||||||
if (template === undefined) {
|
if (template === undefined) {
|
||||||
throw "ERROR form-custom-template::getFieldTemplateValue -> Store is missing form template for [" +
|
throw "ERROR form-custom-template::getFieldTemplateValue -> Store is missing form template for [" +
|
||||||
formKey +
|
formKey +
|
||||||
@@ -65,12 +65,12 @@ export default {
|
|||||||
|
|
||||||
//_https://lodash.com/docs#find
|
//_https://lodash.com/docs#find
|
||||||
//Note that not every field being requested will exist so it's valid to return undefined
|
//Note that not every field being requested will exist so it's valid to return undefined
|
||||||
var templateItem = window.$gz._.find(template, ["fld", fieldKey]);
|
let templateItem = window.$gz._.find(template, ["fld", fieldKey]);
|
||||||
|
|
||||||
return templateItem;
|
return templateItem;
|
||||||
},
|
},
|
||||||
getTemplateConcurrencyToken(formKey) {
|
getTemplateConcurrencyToken(formKey) {
|
||||||
var tok =
|
let tok =
|
||||||
window.$gz.store.state.formCustomTemplate[formKey + "_concurrencyToken"];
|
window.$gz.store.state.formCustomTemplate[formKey + "_concurrencyToken"];
|
||||||
if (tok === undefined) {
|
if (tok === undefined) {
|
||||||
throw "ERROR form-custom-template::getTemplateConcurrencyToken -> Store is missing concurrency token for [" +
|
throw "ERROR form-custom-template::getTemplateConcurrencyToken -> Store is missing concurrency token for [" +
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ function devShowUnknownError(error) {
|
|||||||
// return true if handled or false if not
|
// return true if handled or false if not
|
||||||
//
|
//
|
||||||
function handleError(action, error, route, reject) {
|
function handleError(action, error, route, reject) {
|
||||||
var errorMessage =
|
let errorMessage =
|
||||||
"API error: " + action + " route =" + route + ", message =" + error.message;
|
"API error: " + action + " route =" + route + ", message =" + error.message;
|
||||||
window.$gz.store.commit("logItem", errorMessage);
|
window.$gz.store.commit("logItem", errorMessage);
|
||||||
|
|
||||||
@@ -269,7 +269,7 @@ export default {
|
|||||||
if (typeof obj === "object") {
|
if (typeof obj === "object") {
|
||||||
return Object.keys(obj)
|
return Object.keys(obj)
|
||||||
.map(function(k) {
|
.map(function(k) {
|
||||||
var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
|
let ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
|
||||||
if (Array.isArray(obj[k])) {
|
if (Array.isArray(obj[k])) {
|
||||||
return obj[k]
|
return obj[k]
|
||||||
.map(function(v) {
|
.map(function(v) {
|
||||||
@@ -295,7 +295,7 @@ export default {
|
|||||||
// GET DATA FROM API SERVER
|
// GET DATA FROM API SERVER
|
||||||
//
|
//
|
||||||
get(route) {
|
get(route) {
|
||||||
var that = this;
|
let that = this;
|
||||||
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)
|
||||||
@@ -313,10 +313,10 @@ export default {
|
|||||||
// POST / PUT DATA TO API SERVER
|
// POST / PUT DATA TO API SERVER
|
||||||
//
|
//
|
||||||
upsert(route, data) {
|
upsert(route, data) {
|
||||||
var that = this;
|
let that = this;
|
||||||
return new Promise(function upsertDataToServer(resolve, reject) {
|
return new Promise(function upsertDataToServer(resolve, reject) {
|
||||||
//determine if this is a new or existing record
|
//determine if this is a new or existing record
|
||||||
var fetchOptions = undefined;
|
let fetchOptions = undefined;
|
||||||
if (data.concurrencyToken) {
|
if (data.concurrencyToken) {
|
||||||
//has concurrency token, so this is a PUT as it's updating an existing record
|
//has concurrency token, so this is a PUT as it's updating an existing record
|
||||||
fetchOptions = that.fetchPutOptions(data);
|
fetchOptions = that.fetchPutOptions(data);
|
||||||
@@ -346,7 +346,7 @@ export default {
|
|||||||
// DELETE DATA FROM API SERVER
|
// DELETE DATA FROM API SERVER
|
||||||
//
|
//
|
||||||
remove(route) {
|
remove(route) {
|
||||||
var that = this;
|
let that = this;
|
||||||
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)
|
||||||
@@ -364,7 +364,7 @@ export default {
|
|||||||
// POST DUPLICATE TO API SERVER
|
// POST DUPLICATE TO API SERVER
|
||||||
//
|
//
|
||||||
duplicate(route) {
|
duplicate(route) {
|
||||||
var that = this;
|
let that = this;
|
||||||
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user