This commit is contained in:
2019-06-05 18:38:30 +00:00
parent 47d037dc76
commit 65967d4992
4 changed files with 58 additions and 20 deletions

View File

@@ -61,6 +61,7 @@ export function processLogout() {
store.commit("logItem", "auth::processLogout -> User logged out");
}
store.commit("logout");
sessionStorage.clear(); //clear all temporary session storage data
}
export function isLoggedIn() {

View File

@@ -13,6 +13,7 @@ import Vue from "vue";
import errorHandler from "./errorhandler";
import store from "../store";
var triggeringChange = false;
function isEmpty(o) {
@@ -512,20 +513,35 @@ export default {
// for form specified or empty object if there is none
// EAch form is responsible for what it stores and how it initializes, this just provides that
// the form does the actual work of what settings it requires
// Form settings are temp and saved, saved ones go into vuex and localstorage and temporary ones are stored in session storage
//
getFormSettings(formKey) {
var theFormSettings = store.state.formSettings[formKey];
return theFormSettings;
return {
temp: JSON.parse(sessionStorage.getItem(formKey)),
saved: store.state.formSettings[formKey]
};
},
////////////////////////////////////
// Set form settings
// for form key specified
//
// requires object with one or both keys {temp:{...tempformsettings...},saved:{...persistedformsettings...}}
//
setFormSettings(formKey, formSettings) {
store.commit("setFormSettings", {
formKey: formKey,
formSettings: formSettings
});
if (errorHandler.devMode()) {
if (!formSettings.saved && !formSettings.temp) {
throw "gzform:setFormSettings - saved AND temp keys are both missing from form data!";
}
}
if (formSettings.saved) {
store.commit("setFormSettings", {
formKey: formKey,
formSettings: formSettings.saved
});
}
if (formSettings.temp) {
sessionStorage.setItem(formKey, JSON.stringify(formSettings.temp));
}
}
};