From 284e8d51ba7f6484b97afb6e8ac9b2b2dcf3c306 Mon Sep 17 00:00:00 2001 From: Radu Liviu Carjan Date: Tue, 8 Jun 2021 11:13:28 +0300 Subject: [PATCH] Preserver searchers on document change --- resources/js/components/ProcessFile/ProcessFile.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/resources/js/components/ProcessFile/ProcessFile.ts b/resources/js/components/ProcessFile/ProcessFile.ts index 569dff4..b66f6c5 100644 --- a/resources/js/components/ProcessFile/ProcessFile.ts +++ b/resources/js/components/ProcessFile/ProcessFile.ts @@ -70,6 +70,16 @@ export default class ProcessFile extends Vue { * */ created() { + let storedSearchers = localStorage.getItem('searchers'); + if (storedSearchers !== null) { + this.selectedSearchers = JSON.parse(storedSearchers); + + let searchersOptions = localStorage.getItem('searchersOptions'); + if (searchersOptions !== null) { + this.searchersOptions = JSON.parse(searchersOptions); + } + } + this.intervalId = setInterval(this.waitForFile, 3000); window.addEventListener('beforeunload', async (event) => { @@ -155,6 +165,8 @@ export default class ProcessFile extends Vue { * @param event The event containing the uploaded files information */ public async uploadFile(event: any): Promise { + localStorage.setItem('searchers', JSON.stringify(this.selectedSearchers)); + localStorage.setItem('searchersOptions', JSON.stringify(this.searchersOptions)); this.$confirm.require({ message: 'You will lose any progress on the current uploaded document. Are you sure you want to proceed?', header: 'Confirmation',