feat: Centralize configuration management for Nostr and API settings

- Introduce a new config module to manage Nostr relays, admin pubkeys, and API settings.
- Update components to utilize the centralized config instead of environment variables directly.
- Refactor relevant files to improve maintainability and reduce reliance on environment variables.
This commit is contained in:
padreug 2025-07-02 19:47:55 +02:00
parent 17a1504771
commit 0324cf8ec5
6 changed files with 83 additions and 13 deletions

View file

@ -6,6 +6,7 @@ import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
import QRCode from 'qrcode'
import { config } from '@/lib/config'
interface Props {
event: {
@ -49,14 +50,14 @@ async function handleSubmit() {
isLoading.value = true
error.value = ''
const apiUrl = `${import.meta.env.VITE_API_BASE_URL}/events/api/v1/tickets/${props.event.id}/${encodeURIComponent(name.value)}/${encodeURIComponent(email.value)}`
const apiUrl = `${config.api.baseUrl}/events/api/v1/tickets/${props.event.id}/${encodeURIComponent(name.value)}/${encodeURIComponent(email.value)}`
console.log('Calling API:', apiUrl)
try {
const response = await fetch(apiUrl, {
headers: {
'Accept': 'application/json',
'X-API-KEY': import.meta.env.VITE_API_KEY
'X-API-KEY': config.api.key
}
})