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