From 96b305b74dc84cd78f10604f20d069867f8a5ec8 Mon Sep 17 00:00:00 2001 From: Robert Kossessa Date: Sat, 27 Jan 2024 03:46:35 +0100 Subject: [PATCH] UPD: Profile management --- src/components/ProfileManager.vue | 22 +++++++++++++--------- src/store.js | 12 +++++++++--- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/components/ProfileManager.vue b/src/components/ProfileManager.vue index e6208c7..3e4e834 100644 --- a/src/components/ProfileManager.vue +++ b/src/components/ProfileManager.vue @@ -49,8 +49,8 @@ + :selected="currentProfileId===profile.id" + @select="currentProfileId=profile.id" /> @@ -60,7 +60,7 @@ \ No newline at end of file diff --git a/src/store.js b/src/store.js index 71ae632..434f267 100644 --- a/src/store.js +++ b/src/store.js @@ -1,9 +1,15 @@ -import { reactive } from 'vue' +import { computed, reactive } from 'vue' export const store = reactive({ device: { profiles: [], - activeProfile: null, + activeProfileId: null, + activeProfile: computed(() => { + return store.device.profiles.find(p => p.id === store.device.activeProfileId) + }), }, - currentProfile: null, + currentProfileId: null, + currentProfile: computed(() => { + return store.device.profiles.find(p => p.id === store.currentProfileId) + }), }) \ No newline at end of file