diff options
| author | Tim Keller <tjk@tjkeller.xyz> | 2025-06-24 23:04:37 -0500 |
|---|---|---|
| committer | Tim Keller <tjk@tjkeller.xyz> | 2025-06-24 23:04:37 -0500 |
| commit | 1b1987f28df0eaf3f47fc5833e17a803f7ba1b8c (patch) | |
| tree | c031c736008dbb52ec591aa1c1ed1aed85647306 /static/src | |
| parent | 4be4fd53b3f71d1da55fc7f4c31640bf6f1c4992 (diff) | |
| download | immich-frame-1b1987f28df0eaf3f47fc5833e17a803f7ba1b8c.tar.xz immich-frame-1b1987f28df0eaf3f47fc5833e17a803f7ba1b8c.zip | |
make frontend work with backend and wait until album response recieved before initializing albums page. extra checks around config
Diffstat (limited to 'static/src')
| -rw-r--r-- | static/src/albums.js | 2 | ||||
| -rw-r--r-- | static/src/connector.js | 5 | ||||
| -rw-r--r-- | static/src/pages.js | 4 |
3 files changed, 7 insertions, 4 deletions
diff --git a/static/src/albums.js b/static/src/albums.js index b7523d9..0ac9195 100644 --- a/static/src/albums.js +++ b/static/src/albums.js @@ -69,6 +69,8 @@ class Album { // create albums const albumsResponse = await apiConnector.fetchAlbums() + if (!albumsResponse.length) + return false for (const res of albumsResponse) new Album(res) diff --git a/static/src/connector.js b/static/src/connector.js index 5d8b62f..9568dc8 100644 --- a/static/src/connector.js +++ b/static/src/connector.js @@ -37,12 +37,12 @@ class APIConnector { }) .catch(error => { console.error("Fetch error:", error) + return null }) } async assetDownload(key) { const filename = await this.assetFileName(key) - console.log(filename) fetch(this.assetFullsizeSrc(key)) .then(response => { if (!response.ok) @@ -59,6 +59,7 @@ class APIConnector { }) .catch(error => { console.error("Fetch error:", error) + return null }) } @@ -87,5 +88,5 @@ class APIConnector { assetFileName(key) { return this.fetch(`/asset/${key}/filename`).then(d => d.filename) } } -const apiConnector = new APIConnector("http://localhost:5000") +const apiConnector = new APIConnector(window.location.origin) export default apiConnector diff --git a/static/src/pages.js b/static/src/pages.js index f6a8b9b..e2199a4 100644 --- a/static/src/pages.js +++ b/static/src/pages.js @@ -34,13 +34,13 @@ export default class Page { this.initialized = false } - setVisible(visible) { + async setVisible(visible) { this.pageContainer.classList.toggle("hidden!", !visible) this.visible = visible if (this.visible) { /* initialize page */ if (!this.initialized && this.initialize) - this.initialized = this.initialize(this.pageContainer) + this.initialized = await this.initialize(this.pageContainer) /* set selected attribute on the link */ for (const a of menu.querySelectorAll("a")) { |
