23 lines
598 B
JavaScript
23 lines
598 B
JavaScript
// Get existing Helcim subscriptions to understand the format
|
|
import { listHelcimSubscriptions } from '../../utils/helcim.js'
|
|
|
|
export default defineEventHandler(async (event) => {
|
|
try {
|
|
await requireAdmin(event)
|
|
|
|
const subscriptionsData = await listHelcimSubscriptions()
|
|
|
|
return {
|
|
success: true,
|
|
subscriptions: subscriptionsData
|
|
}
|
|
|
|
} catch (error) {
|
|
if (error.statusCode) throw error
|
|
console.error('Error fetching Helcim subscriptions:', error)
|
|
throw createError({
|
|
statusCode: 500,
|
|
statusMessage: 'An unexpected error occurred'
|
|
})
|
|
}
|
|
})
|