]> git.r.bdr.sh - rbdr/forum/blobdiff - src/stores/actions.js
Update documentation
[rbdr/forum] / src / stores / actions.js
index 3a6d13fbe0ddc8ce62352d21d6768a9c4855d49f..f7fbc28d953672ba8097fce78d38405427e8b3e7 100644 (file)
@@ -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
+);