export default class ImmichConnector { constructor(url, apiKey) { this.url = url this.apiKey = apiKey } fetchAlbums() { return this.fetch("/albums") } fetch(endpoint) { return fetch(this.url + "/api" + endpoint, { headers: { "x-api-key": this.apiKey } }) .then(response => { if (!response.ok) { throw new Error(`HTTP error! Status: ${response.status}`) } return response.json() }) .then(data => { console.log('Fetched data:', data) }) .catch(error => { console.error('Fetch error:', error) }) } }