Implement multi-step registration process: Add step indicators, error handling, and payment processing for membership registration. Enhance form validation and user feedback with success and error messages. Refactor state management for improved clarity and maintainability.
This commit is contained in:
parent
a88aa62198
commit
2ca290d6e0
22 changed files with 1994 additions and 213 deletions
45
server/api/helcim/subscriptions.get.js
Normal file
45
server/api/helcim/subscriptions.get.js
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
// Get existing Helcim subscriptions to understand the format
|
||||
const HELCIM_API_BASE = 'https://api.helcim.com/v2'
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
try {
|
||||
const config = useRuntimeConfig(event)
|
||||
const helcimToken = config.public.helcimToken || process.env.NUXT_PUBLIC_HELCIM_TOKEN
|
||||
|
||||
console.log('Fetching existing subscriptions from Helcim...')
|
||||
|
||||
const response = await fetch(`${HELCIM_API_BASE}/subscriptions`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'accept': 'application/json',
|
||||
'api-token': helcimToken
|
||||
}
|
||||
})
|
||||
|
||||
if (!response.ok) {
|
||||
console.error('Failed to fetch subscriptions:', response.status, response.statusText)
|
||||
const errorText = await response.text()
|
||||
console.error('Response body:', errorText)
|
||||
|
||||
throw createError({
|
||||
statusCode: response.status,
|
||||
statusMessage: `Failed to fetch subscriptions: ${errorText}`
|
||||
})
|
||||
}
|
||||
|
||||
const subscriptionsData = await response.json()
|
||||
console.log('Existing subscriptions:', JSON.stringify(subscriptionsData, null, 2))
|
||||
|
||||
return {
|
||||
success: true,
|
||||
subscriptions: subscriptionsData
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error fetching Helcim subscriptions:', error)
|
||||
throw createError({
|
||||
statusCode: error.statusCode || 500,
|
||||
statusMessage: error.message || 'Failed to fetch subscriptions'
|
||||
})
|
||||
}
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue