env variables handling
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// pushSettingsUI.js - UI handling for push notification settings
|
||||
import { setupPushNotifications } from '../services/serviceWorkerManager.js';
|
||||
import { FLIC_BUTTON_ID } from '../config.js';
|
||||
import { FLIC_BUTTON_ID, getBackendUrl} from '../config.js';
|
||||
|
||||
// --- DOM Elements ---
|
||||
const elements = {
|
||||
@@ -381,20 +381,9 @@ export async function sendSubscriptionToServer() {
|
||||
'Authorization': createBasicAuthHeader(credentials)
|
||||
};
|
||||
|
||||
// Import the backend URL from config
|
||||
let backendUrl;
|
||||
try {
|
||||
const configModule = await import('../config.js');
|
||||
backendUrl = configModule.BACKEND_URL;
|
||||
} catch (error) {
|
||||
// No alert, just log the error and return
|
||||
console.error('Could not get backend URL from config:', error);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// Make the request to the server
|
||||
const response = await fetch(`${backendUrl}/subscribe`, {
|
||||
const response = await fetch(`${getBackendUrl()}/subscribe`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
button_id: FLIC_BUTTON_ID,
|
||||
|
||||
Reference in New Issue
Block a user