File tree Expand file tree Collapse file tree 2 files changed +9
-17
lines changed Expand file tree Collapse file tree 2 files changed +9
-17
lines changed Original file line number Diff line number Diff line change 10
10
@update:model-value =" handleUpdateValue"
11
11
>
12
12
<PListboxOption
13
- v-for =" template in templates"
14
- :key =" template.uuid"
15
- :label =" template.title"
16
- :value =" template"
17
- @click =" selectValue(template)"
18
- />
19
-
20
- <hr
21
- v-if =" templates?.length && sharedTemplates?.length"
22
- class =" my-2 border-gray-10"
23
- />
24
-
25
- <PListboxOption
26
- v-for =" template in sharedTemplates"
13
+ v-for =" template in [...(templates || []), ...(sharedTemplates || [])]"
27
14
:key =" template.uuid"
28
15
:label =" template.title"
29
16
:value =" template"
@@ -76,9 +63,8 @@ const selectionDraft = ref<Note | null>(null);
76
63
const showConfirm = ref (false );
77
64
78
65
const { t } = useI18n ();
79
- const { data : templates, pending : isTemplatesLoading } = useGetNotes ({
80
- type: NOTE_TYPE .template ,
81
- });
66
+ const { data : templates, pending : isTemplatesLoading } = useGetTemplates ();
67
+ // TODO: integrate shared templates in the templates api
82
68
const { data : sharedTemplates, pending : isSharedTemplatesLoading } =
83
69
useGetNotes ({
84
70
type: NOTE_TYPE .template ,
Original file line number Diff line number Diff line change
1
+ type GetTemplatesResponse = Note [ ] ;
2
+
3
+ export const useGetTemplates = ( ) =>
4
+ useApiFetch < GetTemplatesResponse > ( '/templates/' , {
5
+ key : 'templates'
6
+ } ) ;
You can’t perform that action at this time.
0 commit comments