Skip to content
Snippets Groups Projects
Commit 582de660 authored by Bhabesh Bhabani Mukhopadhyay's avatar Bhabesh Bhabani Mukhopadhyay
Browse files

Remove all local stored data from app on logout

parent ad27045f
Branches
No related tags found
No related merge requests found
......@@ -201,13 +201,51 @@ export default {
}
});
},
handleLogout()
{
this.$root.sharedState.uuid = ''; // remove global uuid for other (e.g. menu items etc)
localStorage.removeItem(CommonUtil.CONST_STORAGE_UUID); // remove uuid from storage
this.$emit(CommonUtil.CONST_EVENT_LOGIN_USER_DETAIL,'');
$('.offcanvas-collapse').removeClass('open');
}
handleLogout()
{
this.$root.sharedState.uuid = ''; // remove global uuid for other (e.g. menu items etc)
/** Remove stored data from app in local system - server data still preserve */
this.removeStoredData();
this.$emit(CommonUtil.CONST_EVENT_LOGIN_USER_DETAIL,'');
$('.offcanvas-collapse').removeClass('open');
},
/** Remove stored data on logout */
removeStoredData()
{
/* Remove localstorage */
localStorage.removeItem(CommonUtil.CONST_STORAGE_OBSERVATION_LIST);
localStorage.removeItem(CommonUtil.CONST_STORAGE_UUID);
localStorage.removeItem(CommonUtil.CONST_STORAGE_USER_DETAIL);
localStorage.removeItem(CommonUtil.CONST_STORE_TIMESTAMP);
localStorage.removeItem(CommonUtil.CONST_STORAGE_CROP_CATEGORY);
localStorage.removeItem(CommonUtil.CONST_STORAGE_CROP_ID_LIST);
localStorage.removeItem(CommonUtil.CONST_STORAGE_CROP_LIST);
localStorage.removeItem(CommonUtil.CONST_STORAGE_PEST_LIST);
localStorage.removeItem(CommonUtil.CONST_STORAGE_CROP_PEST_LIST);
localStorage.removeItem(CommonUtil.CONST_STORAGE_IMAGE_LIST);
localStorage.removeItem(CommonUtil.CONST_STORAGE_POI_LIST);
localStorage.removeItem(CommonUtil.CONST_STORAGE_VISIBILITY_POLYGON);
/* Remove from IndexedDB */
let dbRequest = null;
dbRequest = indexedDB.open(CommonUtil.CONST_DB_NAME, CommonUtil.CONST_DB_VERSION);
dbRequest.onsuccess = function(evt) {
let db = evt.target.result;
db.close();
}
let delReq = indexedDB.deleteDatabase(CommonUtil.CONST_DB_NAME);
delReq.onerror = function()
{
console.log('could not delete database');
}
delReq.onblocked = function()
{
console.log('delete DB not successful because of operation block');
}
}
},
mounted() {
......
......@@ -424,20 +424,8 @@ export default {
}
dbRequest.onsuccess = function(evt) {
let db = evt.target.result;
if(db.objectStoreNames.contains(This.entityName))
{}
else
{
//observationImage.illustration.fileName
//This.createEntity(db,This.entityName, null);
//This.checkDBUpgrade(dbRequest,This.entityName, null);
let store = db.createObjectStore(This.entityName,{ keyPath: "1_test.jpg" });
console.log('inside else');
}
let transaction = db.transaction([This.entityName],'readwrite');
let db = evt.target.result;
let transaction = db.transaction([This.entityName],'readwrite');
let objectstore = transaction.objectStore(This.entityName);
let indexStore = objectstore.index(indexName);
let keyRange = IDBKeyRange.only(indexValue);
......@@ -701,12 +689,6 @@ export default {
}
},
mounted(){
this.CONST_URL_DOMAIN = CommonUtil.CONST_URL_DOMAIN;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment