This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
/*e slint-disable */
|
||||
import store from "../store";
|
||||
import gzapi from "./gzapi";
|
||||
import _ from "../libs/lodash.min.js";
|
||||
|
||||
///Add data key names which make the custom fields control work more easily
|
||||
///Since the names can be inferred from the data that comes from the server it saves bandwidth to do it here at the client
|
||||
@@ -21,14 +18,16 @@ function addDataKeyNames(obj) {
|
||||
export default {
|
||||
get(formKey) {
|
||||
return new Promise(function getFormTemplate(resolve) {
|
||||
if (!_.has(store.state.formCustomTemplate, formKey)) {
|
||||
if (
|
||||
!window.$gz._.has(window.$gz.store.state.formCustomTemplate, formKey)
|
||||
) {
|
||||
//fetch and populate the store
|
||||
gzapi.get("formcustom/" + formKey).then(res => {
|
||||
window.$gz.api.get("formcustom/" + formKey).then(res => {
|
||||
if (res.error) {
|
||||
throw res.error;
|
||||
}
|
||||
|
||||
store.commit("addFormCustomTemplateItem", {
|
||||
window.$gz.store.commit("addFormCustomTemplateItem", {
|
||||
formKey: formKey,
|
||||
value: addDataKeyNames(JSON.parse(res.data.template))
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user