This commit is contained in:
27
ayanova/src/api/form-custom-template.js
Normal file
27
ayanova/src/api/form-custom-template.js
Normal file
@@ -0,0 +1,27 @@
|
||||
/* ZZeslint-disable */
|
||||
import store from "../store";
|
||||
import gzapi from "./gzapi";
|
||||
import _ from "../libs/lodash.min.js";
|
||||
|
||||
export default {
|
||||
get(formKey) {
|
||||
return new Promise(function getFormTemplate(resolve) {
|
||||
// debugger;
|
||||
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();
|
||||
});
|
||||
} else {
|
||||
resolve(store.state.formCustom[formKey]);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user