]>
Commit | Line | Data |
---|---|---|
55fb920b | 1 | import { derived, writable } from 'svelte/store'; |
58f7d521 RBR |
2 | |
3 | /* | |
4 | * This is a store to set the actions in the top header. | |
5 | */ | |
6 | ||
26dfa00e | 7 | const actions = writable({}); |
58f7d521 RBR |
8 | |
9 | export const enableTopicActions = (id) => { | |
10 | ||
11 | actions.update((actionsValue) => { | |
12 | ||
55fb920b RBR |
13 | actionsValue.topic = { |
14 | id | |
15 | }; | |
58f7d521 RBR |
16 | return actionsValue; |
17 | }); | |
18 | }; | |
19 | ||
20 | export const disableTopicActions = () => { | |
21 | ||
22 | actions.update((actionsValue) => { | |
23 | ||
55fb920b | 24 | delete actionsValue.topic; |
58f7d521 RBR |
25 | return actionsValue; |
26 | }); | |
27 | }; | |
55fb920b RBR |
28 | |
29 | export const topicActions = derived( | |
30 | actions, | |
31 | ($actions) => $actions.topic | |
32 | ); |