mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 12:08:01 +00:00
feat: refresh the audit page on navigation without manual reload (#7292)
Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Co-authored-by: Shivam Mishra <scm.mymail@gmail.com>
This commit is contained in:
@@ -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',
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user