Skip to content

Commit 1981d79

Browse files
authored
Merge pull request #67 from sotoon/fix-public-templates
fix: display public templates
2 parents 7aac8d0 + 6de81ec commit 1981d79

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

frontend/src/components/note/NoteTemplateSelect.vue

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,7 @@
1010
@update:model-value="handleUpdateValue"
1111
>
1212
<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 || [])]"
2714
:key="template.uuid"
2815
:label="template.title"
2916
:value="template"
@@ -76,9 +63,8 @@ const selectionDraft = ref<Note | null>(null);
7663
const showConfirm = ref(false);
7764
7865
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
8268
const { data: sharedTemplates, pending: isSharedTemplatesLoading } =
8369
useGetNotes({
8470
type: NOTE_TYPE.template,
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
type GetTemplatesResponse = Note[];
2+
3+
export const useGetTemplates = () =>
4+
useApiFetch<GetTemplatesResponse>('/templates/', {
5+
key: 'templates'
6+
});

0 commit comments

Comments
 (0)