-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;
});
};
actions.update((actionsValue) => {
- delete actionsValue.id;
+ delete actionsValue.topic;
return actionsValue;
});
};
+
+export const topicActions = derived(
+ actions,
+ ($actions) => $actions.topic
+);