This commit is contained in:
@@ -93,10 +93,14 @@ const MAX_RESULTS = 200;
|
||||
export default {
|
||||
beforeRouteLeave(to, from, next) {
|
||||
let vm = this;
|
||||
//save last search in session cache if there is something to save
|
||||
|
||||
//save last search in session cache
|
||||
window.$gz.form.setFormSettings(FORM_KEY, {
|
||||
temp: { page: vm.dataTablePagingOptions.page, cachedListView: cachedlv }
|
||||
temp: {
|
||||
ayaType: vm.searchObjectType,
|
||||
phrase: vm.searchPhrase,
|
||||
items: vm.items,
|
||||
maxResultsReturned: vm.maxResultsReturned
|
||||
}
|
||||
});
|
||||
|
||||
next();
|
||||
@@ -108,13 +112,25 @@ export default {
|
||||
vm.formState.ready = true;
|
||||
window.$gz.eventBus.$on("menu-click", clickHandler);
|
||||
generateMenu(vm);
|
||||
if (vm.$route.params.ayatype) {
|
||||
vm.searchObjectType = vm.$route.params.ayatype;
|
||||
}
|
||||
|
||||
//get form settings from session cache, if same type as in route then re-use teh last search stuff
|
||||
//however if different than need to clear it (or not rehydrate it)
|
||||
let formSettings = window.$gz.form.getFormSettings(FORM_KEY);
|
||||
let savedSettings = window.$gz.form.getFormSettings(FORM_KEY);
|
||||
|
||||
if (vm.$route.params.ayatype) {
|
||||
vm.searchObjectType = vm.$route.params.ayatype;
|
||||
if (savedSettings && savedSettings.temp) {
|
||||
savedSettings = savedSettings.temp;
|
||||
if (
|
||||
vm.searchObjectType == 0 ||
|
||||
vm.searchObjectType == savedSettings.ayaType
|
||||
) {
|
||||
//same type or no type so go ahead and rehydrate
|
||||
vm.searchPhrase = savedSettings.phrase;
|
||||
vm.searchObjectType = savedSettings.ayaType;
|
||||
vm.items = savedSettings.items;
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
|
||||
Reference in New Issue
Block a user