Skip to content

Commit

Permalink
feat: refresh the audit page on navigation without manual reload (#7292)
Browse files Browse the repository at this point in the history
Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
Co-authored-by: Shivam Mishra <scm.mymail@gmail.com>
  • Loading branch information
3 people committed Jun 20, 2023
1 parent 9ac4a1e commit bc813b7
Showing 1 changed file with 14 additions and 1 deletion.
Expand Up @@ -80,6 +80,12 @@ export default {
},
};
},
beforeRouteEnter(to, from, next) {
// Fetch Audit Logs on page load without manual refresh
next(vm => {
vm.fetchAuditLogs();
});
},
computed: {
...mapGetters({
records: 'auditlogs/getAuditLogs',
Expand All @@ -90,10 +96,17 @@ export default {
},
mounted() {
// Fetch API Call
this.$store.dispatch('auditlogs/fetch', { page: 1 });
this.$store.dispatch('agents/get');
},
methods: {
fetchAuditLogs() {
const page = this.$route.query.page ?? 1;
this.$store.dispatch('auditlogs/fetch', { page }).catch(error => {
const errorMessage =
error?.message || this.$t('AUDIT_LOGS.API.ERROR_MESSAGE');
this.showAlert(errorMessage);
});
},
getAgentName(email) {
if (email === null) {
return this.$t('AUDIT_LOGS.DEFAULT_USER');
Expand Down

0 comments on commit bc813b7

Please sign in to comment.