This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* ZZeslint-disable */
|
||||
/* eslint-disable */
|
||||
import store from "../store";
|
||||
import gzapi from "./gzapi";
|
||||
import _ from "../libs/lodash.min.js";
|
||||
@@ -6,21 +6,20 @@ import _ from "../libs/lodash.min.js";
|
||||
export default {
|
||||
get(formKey) {
|
||||
return new Promise(function getFormTemplate(resolve) {
|
||||
// debugger;
|
||||
if (!_.has(store.state.formCustom, formKey)) {
|
||||
if (!_.has(store.state.formCustom, formKey)) {
|
||||
//fetch and populate the store
|
||||
fetch(gzapi.APIUrl("formcustom/" + formKey))
|
||||
.then(gzapi.status)
|
||||
.then(gzapi.json)
|
||||
.then(response => {
|
||||
store.commit("addLocaleText", {
|
||||
formKey: formKey,
|
||||
value: response
|
||||
});
|
||||
resolve();
|
||||
gzapi.get("formcustom/" + formKey).then(res => {
|
||||
debugger;
|
||||
if (res.error) {
|
||||
throw res.error;
|
||||
}
|
||||
|
||||
store.commit("addFormCustomTemplateItem", {
|
||||
formKey: formKey,
|
||||
value: JSON.parse(res.data.template)
|
||||
});
|
||||
} else {
|
||||
resolve(store.state.formCustom[formKey]);
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user