web/satellite: clear objects vuex state on destroy. Always fetch buckets list

WHAT:
clear objects vuex state on leaving /objects/... route
always fetch buckets when entering buckets view

WHY:
storing/caching bug fix for buckets view

Change-Id: I04f3ee5cf2e762471f248ecbaee3dc68ed28ac5c
This commit is contained in:
Vitalii Shpital 2021-04-09 17:11:52 +03:00
parent 2a4a70908f
commit 6f5f2dd36d
2 changed files with 15 additions and 9 deletions

View File

@ -103,20 +103,17 @@ export default class BucketsView extends Vue {
}
try {
if (!this.accessGrantFromStore) {
await this.setWorker();
// This is done just in case old temporary access grant still exists.
await this.removeTemporaryAccessGrant();
await this.setAccess();
await this.fetchBuckets();
}
this.isLoading = false;
await this.setWorker();
await this.removeTemporaryAccessGrant();
await this.setAccess();
await this.fetchBuckets();
if (!this.bucketsList.length) this.showCreateBucketPopup();
} catch (error) {
await this.$notify.error(`Failed to setup Buckets view. ${error.message}`);
}
this.isLoading = false;
}
/**

View File

@ -11,6 +11,7 @@
import { Component, Vue } from 'vue-property-decorator';
import { RouteConfig } from '@/router';
import { OBJECTS_ACTIONS } from '@/store/modules/objects';
import { MetaUtils } from '@/utils/meta';
@Component
@ -24,6 +25,14 @@ export default class ObjectsArea extends Vue {
await this.$router.push(RouteConfig.ProjectDashboard.path);
}
}
/**
* Lifecycle hook before component destroying.
* Clears objects VUEX state.
*/
public beforeDestroy() {
this.$store.dispatch(OBJECTS_ACTIONS.CLEAR);
}
}
</script>