aboutsummaryrefslogtreecommitdiff
path: root/src/stores
diff options
context:
space:
mode:
authorRuben Beltran del Rio <ruben@unlimited.pizza>2021-04-22 23:02:02 +0200
committerRuben Beltran del Rio <ruben@unlimited.pizza>2021-04-22 23:02:02 +0200
commit55fb920baa9792266be1a6b981f954c622c1eaf9 (patch)
tree0016f699d26e6d2226da4748476485713c9fae88 /src/stores
parent2ec82213d1dafb17b7a445451fe6e49cff632475 (diff)
Add tests for header
Also patches up the leaky abstraction on the actions
Diffstat (limited to 'src/stores')
-rw-r--r--src/stores/actions.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/stores/actions.js b/src/stores/actions.js
index 3a6d13f..ae01906 100644
--- a/src/stores/actions.js
+++ b/src/stores/actions.js
@@ -1,4 +1,4 @@
-import { writable } from 'svelte/store';
+import { derived, writable } from 'svelte/store';
/*
* This is a store to set the actions in the top header.
@@ -10,7 +10,9 @@ 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
+);