X-Git-Url: https://git.r.bdr.sh/rbdr/forum/blobdiff_plain/58f7d52150456713d3132408668a92d0f6f3d084..fb76052a02708a8fafa310d99d7d7b403b4b7ad8:/src/stores/actions.js diff --git a/src/stores/actions.js b/src/stores/actions.js index 3a6d13f..f7fbc28 100644 --- a/src/stores/actions.js +++ b/src/stores/actions.js @@ -1,16 +1,18 @@ -import { writable } from 'svelte/store'; +import { derived, writable } from 'svelte/store'; /* * This is a store to set the actions in the top header. */ -export const actions = writable({}); +const actions = writable({}); export const enableTopicActions = (id) => { actions.update((actionsValue) => { - actionsValue.topic_id = id; + actionsValue.topic = { + id + }; return actionsValue; }); }; @@ -19,7 +21,12 @@ export const disableTopicActions = () => { actions.update((actionsValue) => { - delete actionsValue.id; + delete actionsValue.topic; return actionsValue; }); }; + +export const topicActions = derived( + actions, + ($actions) => $actions.topic +);