Link support 1/2
All checks were successful
Build and Deploy Nuxt / build (push) Successful in 59s

This commit is contained in:
2026-05-03 01:02:13 +02:00
parent 030060286f
commit 94e2b8bd47
6 changed files with 71 additions and 169 deletions

View File

@@ -4,7 +4,6 @@ import { computed, onMounted, onUnmounted, ref, watch } from 'vue';
import { useCampaignService } from '~/services/Campaign.js';
import { emitter } from '~/services/Emitter';
import Server from '~/services/Server';
import { CreateWindow } from '~/services/Windows';
const { Campaign } = useCampaignService();
const notes = ref([]);
@@ -64,14 +63,31 @@ function toggleSidebar() {
sidebarCollapsed.value = !sidebarCollapsed.value;
}
function openCreateNoteWindow() {
async function createNote() {
if (!Campaign.value) {
return;
}
CreateWindow('create_note');
const campaignId = Campaign.value?._id
try {
const response = await Server().post('/note/create', {
title: 'New note',
content: "",
campaign: campaignId
});
if (response.data.status !== 'ok') {
return;
}
emitter.emit('note-created', response.data.note);
} catch (err) {
console.log(err);
}
}
function openNote(note) {
emitter.emit('push-note', note);
}
@@ -136,7 +152,7 @@ watch(Campaign, () => {
<button
class="sidebar-action"
type="button"
@click="openCreateNoteWindow"
@click="createNote"
:disabled="!Campaign"
title="New note"
aria-label="New note"