This commit is contained in:
@@ -6,7 +6,7 @@ function addDataKeyNames(obj) {
|
||||
//iterate the array of objects
|
||||
//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) {
|
||||
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) {
|
||||
throw "ERROR form-custom-template::getFieldTemplateValue -> Store is missing form template for [" +
|
||||
formKey +
|
||||
@@ -65,12 +65,12 @@ export default {
|
||||
|
||||
//_https://lodash.com/docs#find
|
||||
//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;
|
||||
},
|
||||
getTemplateConcurrencyToken(formKey) {
|
||||
var tok =
|
||||
let tok =
|
||||
window.$gz.store.state.formCustomTemplate[formKey + "_concurrencyToken"];
|
||||
if (tok === undefined) {
|
||||
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
|
||||
//
|
||||
function handleError(action, error, route, reject) {
|
||||
var errorMessage =
|
||||
let errorMessage =
|
||||
"API error: " + action + " route =" + route + ", message =" + error.message;
|
||||
window.$gz.store.commit("logItem", errorMessage);
|
||||
|
||||
@@ -269,7 +269,7 @@ export default {
|
||||
if (typeof obj === "object") {
|
||||
return Object.keys(obj)
|
||||
.map(function(k) {
|
||||
var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
|
||||
let ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
|
||||
if (Array.isArray(obj[k])) {
|
||||
return obj[k]
|
||||
.map(function(v) {
|
||||
@@ -295,7 +295,7 @@ export default {
|
||||
// GET DATA FROM API SERVER
|
||||
//
|
||||
get(route) {
|
||||
var that = this;
|
||||
let that = this;
|
||||
return new Promise(function getDataFromServer(resolve, reject) {
|
||||
fetch(that.APIUrl(route), that.fetchGetOptions())
|
||||
.then(that.status)
|
||||
@@ -313,10 +313,10 @@ export default {
|
||||
// POST / PUT DATA TO API SERVER
|
||||
//
|
||||
upsert(route, data) {
|
||||
var that = this;
|
||||
let that = this;
|
||||
return new Promise(function upsertDataToServer(resolve, reject) {
|
||||
//determine if this is a new or existing record
|
||||
var fetchOptions = undefined;
|
||||
let fetchOptions = undefined;
|
||||
if (data.concurrencyToken) {
|
||||
//has concurrency token, so this is a PUT as it's updating an existing record
|
||||
fetchOptions = that.fetchPutOptions(data);
|
||||
@@ -346,7 +346,7 @@ export default {
|
||||
// DELETE DATA FROM API SERVER
|
||||
//
|
||||
remove(route) {
|
||||
var that = this;
|
||||
let that = this;
|
||||
return new Promise(function removeDataFromServer(resolve, reject) {
|
||||
fetch(that.APIUrl(route), that.fetchRemoveOptions())
|
||||
.then(that.status)
|
||||
@@ -364,7 +364,7 @@ export default {
|
||||
// POST DUPLICATE TO API SERVER
|
||||
//
|
||||
duplicate(route) {
|
||||
var that = this;
|
||||
let that = this;
|
||||
return new Promise(function duplicateRecordOnServer(resolve, reject) {
|
||||
fetch(that.APIUrl(route), that.fetchPostOptions(null))
|
||||
.then(that.status)
|
||||
|
||||
Reference in New Issue
Block a user