This commit is contained in:
@@ -17,30 +17,19 @@ function addDataKeyNames(obj) {
|
||||
|
||||
export default {
|
||||
// cache the form customization data if it's not already present
|
||||
//cache invalidation is hard, this needs it...hmmm....
|
||||
//for now will rely on logout and back in to clear up any customization issues
|
||||
get(formKey) {
|
||||
return new Promise(function getFormTemplate(resolve) {
|
||||
if (
|
||||
!window.$gz._.has(window.$gz.store.state.formCustomTemplate, formKey)
|
||||
) {
|
||||
//fetch and populate the store
|
||||
window.$gz.api.get("form-custom/" + formKey).then(res => {
|
||||
if (res.error) {
|
||||
throw res.error;
|
||||
}
|
||||
window.$gz.store.commit("setFormCustomTemplateItem", {
|
||||
formKey: formKey,
|
||||
concurrency: res.data.concurrency,
|
||||
value: addDataKeyNames(JSON.parse(res.data.template))
|
||||
});
|
||||
|
||||
resolve();
|
||||
});
|
||||
} else {
|
||||
resolve();
|
||||
async get(formKey) {
|
||||
if (!window.$gz._.has(window.$gz.store.state.formCustomTemplate, formKey)) {
|
||||
//fetch and populate the store
|
||||
let res = await window.$gz.api.get("form-custom/" + formKey);
|
||||
if (res.error) {
|
||||
throw res.error;
|
||||
}
|
||||
});
|
||||
window.$gz.store.commit("setFormCustomTemplateItem", {
|
||||
formKey: formKey,
|
||||
concurrency: res.data.concurrency,
|
||||
value: addDataKeyNames(JSON.parse(res.data.template))
|
||||
});
|
||||
}
|
||||
},
|
||||
set(formKey, token, template) {
|
||||
window.$gz.store.commit("setFormCustomTemplateItem", {
|
||||
|
||||
Reference in New Issue
Block a user