Track changes to projects list.

The main application component listens for project events and
updates the Vuex store when a project related event is seen.
This commit is contained in:
D. Berge
2023-10-28 11:25:37 +02:00
parent 219425245f
commit f684e3e8d6

View File

@@ -35,7 +35,7 @@
</style>
<script>
import { mapActions } from 'vuex';
import { mapActions, mapGetters } from 'vuex';
import DougalNavigation from './components/navigation';
import DougalFooter from './components/footer';
@@ -53,7 +53,8 @@ export default {
computed: {
snackText () { return this.$store.state.snack.snackText },
snackColour () { return this.$store.state.snack.snackColour }
snackColour () { return this.$store.state.snack.snackColour },
...mapGetters(["serverEvent"])
},
watch: {
@@ -75,17 +76,25 @@ export default {
if (!newVal) {
this.$store.commit('setSnackText', "");
}
},
async serverEvent (event) {
if (event.channel == "project" && event.payload?.schema == "public") {
// Projects changed in some way or another
await this.refreshProjects();
}
}
},
methods: {
...mapActions(["setCredentials"])
...mapActions(["setCredentials", "refreshProjects"])
},
mounted () {
async mounted () {
// Local Storage values are always strings
this.$vuetify.theme.dark = localStorage.getItem("darkTheme") == "true";
this.setCredentials()
await this.setCredentials();
this.refreshProjects();
}
};