Set $matrix variable inside Vuex store

This commit is contained in:
N-Pex 2025-05-12 12:39:22 +02:00
parent 96ef4885d6
commit fba172d5cf
2 changed files with 6 additions and 3 deletions

View file

@ -184,6 +184,9 @@ app.config.globalProperties.$i18n = i18n;
app.use(matrix, { store: store, i18n: i18n }); app.use(matrix, { store: store, i18n: i18n });
// Set $matrix inside data store
store.$matrix = app.$matrix;
if (app.$config.accentColor) { if (app.$config.accentColor) {
app.$vuetify.theme.themes.light.primary = app.$config.accentColor; app.$vuetify.theme.themes.light.primary = app.$config.accentColor;
} }

View file

@ -104,7 +104,7 @@ const store = createStore({
}, },
actions: { actions: {
login({ commit }, { user, registrationFlowHandler }) { login({ commit }, { user, registrationFlowHandler }) {
return this._vm.$matrix.login(user, registrationFlowHandler).then( return this.$matrix.login(user, registrationFlowHandler).then(
user => { user => {
commit('loginSuccess', user); commit('loginSuccess', user);
return Promise.resolve(user); return Promise.resolve(user);
@ -116,7 +116,7 @@ const store = createStore({
); );
}, },
createUser({ commit }, { user, registrationFlowHandler }) { createUser({ commit }, { user, registrationFlowHandler }) {
return this._vm.$matrix.login(user, registrationFlowHandler, true).then( return this.$matrix.login(user, registrationFlowHandler, true).then(
user => { user => {
commit('loginSuccess', user); commit('loginSuccess', user);
return Promise.resolve(user); return Promise.resolve(user);
@ -128,7 +128,7 @@ const store = createStore({
); );
}, },
logout({ commit }) { logout({ commit }) {
this._vm.$matrix.logout(); this.$matrix.logout();
commit('logout'); commit('logout');
}, },
}, },