fix: use private helcimApiToken for all server-side Helcim API calls

This commit is contained in:
Jennie Robinson Faber 2026-04-04 13:37:34 +01:00
parent ccd1d0783a
commit d31b5b4dac
53 changed files with 1755 additions and 572 deletions

View file

@ -361,6 +361,25 @@
</div>
</div>
</div>
<!-- Confirm Action Modal -->
<div v-if="confirmAction.show" class="modal-overlay" @click.self="confirmAction.show = false">
<div class="modal">
<div class="modal-header">
<h2>{{ confirmAction.heading }}</h2>
<button class="modal-close" @click="confirmAction.show = false">&times;</button>
</div>
<div class="modal-body">
<p>{{ confirmAction.message }}</p>
<p class="help-text" style="margin-top: 8px;">This action cannot be undone.</p>
</div>
<div class="modal-actions">
<button class="btn" @click="confirmAction.show = false">Cancel</button>
<button class="btn btn-danger" :disabled="confirmAction.running" @click="confirmAction.execute">
{{ confirmAction.running ? 'Working...' : confirmAction.label }}
</button>
</div>
</div>
</div>
</div>
</template>
@ -496,29 +515,47 @@ const editEvent = (event) => {
navigateTo(`/admin/events/create?edit=${event.id}`)
}
const removeFromSeries = async (event) => {
if (!confirm(`Remove "${event.title}" from its series?`)) return
const confirmAction = reactive({
show: false,
heading: '',
message: '',
label: '',
running: false,
execute: () => {},
})
try {
await $fetch(`/api/admin/events/${event.id}`, {
method: 'PUT',
body: {
...event,
series: {
isSeriesEvent: false,
id: '',
title: '',
description: '',
type: 'workshop_series',
position: 1,
totalEvents: null,
const removeFromSeries = (event) => {
confirmAction.heading = 'Remove from Series'
confirmAction.message = `Remove "${event.title}" from its series?`
confirmAction.label = 'Remove'
confirmAction.running = false
confirmAction.execute = async () => {
confirmAction.running = true
try {
await $fetch(`/api/admin/events/${event.id}`, {
method: 'PUT',
body: {
...event,
series: {
isSeriesEvent: false,
id: '',
title: '',
description: '',
type: 'workshop_series',
position: 1,
totalEvents: null,
},
},
},
})
await refresh()
} catch (error) {
console.error('Failed to remove event from series:', error)
})
confirmAction.show = false
await refresh()
} catch (error) {
console.error('Failed to remove event from series:', error)
} finally {
confirmAction.running = false
}
}
confirmAction.show = true
}
const addEventToSeries = (series) => {
@ -572,23 +609,32 @@ const saveSeriesEdit = async () => {
}
}
const deleteSeries = async (series) => {
if (!confirm(`Delete the entire "${series.title}" series? This will remove the series relationship from all ${series.eventCount} events.`)) return
try {
for (const event of series.events) {
await $fetch(`/api/admin/events/${event.id}`, {
method: 'PUT',
body: {
...event,
series: { isSeriesEvent: false, id: '', title: '', description: '', type: 'workshop_series', position: 1, totalEvents: null },
},
})
const deleteSeries = (series) => {
confirmAction.heading = 'Delete Series'
confirmAction.message = `Delete the entire "${series.title}" series? This will remove the series relationship from all ${series.eventCount} events.`
confirmAction.label = 'Delete'
confirmAction.running = false
confirmAction.execute = async () => {
confirmAction.running = true
try {
for (const event of series.events) {
await $fetch(`/api/admin/events/${event.id}`, {
method: 'PUT',
body: {
...event,
series: { isSeriesEvent: false, id: '', title: '', description: '', type: 'workshop_series', position: 1, totalEvents: null },
},
})
}
confirmAction.show = false
await refresh()
} catch (error) {
console.error('Failed to delete series:', error)
} finally {
confirmAction.running = false
}
await refresh()
} catch (error) {
console.error('Failed to delete series:', error)
}
confirmAction.show = true
}
const manageSeriesTickets = (series) => {