Fix Load Albums button in the photos widget dialog
The dialog calls /albums via window.FRAME_API, but that's repointed to this widget's own API base while a dialog is open (see frame_layout.js) -- /albums is frame-level (lists the owner's whole Immich library, not scoped to one photo widget), so it needs window.FRAME_BASE_API instead. The button silently 404'd since the resulting URL never existed.
This commit is contained in:
@@ -73,7 +73,12 @@ async function savePhotoSettings() {
|
||||
function initPhotosDialog() {
|
||||
document.getElementById('load-albums').addEventListener('click', async () => {
|
||||
try {
|
||||
const resp = await fetch(`${window.FRAME_API}/albums`);
|
||||
// /albums is frame-level (routers/api_frames.py) -- it lists the
|
||||
// frame owner's whole Immich library, not something scoped to
|
||||
// this one photo widget -- so it uses window.FRAME_BASE_API (the
|
||||
// stable frame-level base), not window.FRAME_API (repointed to
|
||||
// this widget's own API base while the dialog is open).
|
||||
const resp = await fetch(`${window.FRAME_BASE_API}/albums`);
|
||||
if (!resp.ok) {
|
||||
throw new Error(await apiError(resp));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user