From 3a799c71d4e6a0abb6f479176cd1983065bf57b2 Mon Sep 17 00:00:00 2001 From: delchev Date: Sat, 11 Jul 2026 12:58:56 +0300 Subject: [PATCH] fix(template): Harmonia personal (my) pages call the wrong API object The generated personal ("my") list/form pages invoked App.api.get/put/post/del, but the shared Harmonia runtime exposes the fetch client as App.services.api (and the delete method is delete(), not del()). App.api is undefined, so every personal surface threw "Cannot read properties of undefined (reading 'get')" on load and rendered its error state instead of the records. Point the my-list/my-form templates at App.services.api.{get,put,post,delete}, matching every other generated page (the loadOptions() call in the same form template already used App.services.api.getAll correctly - these were copy typos). Verified on a running instance: the My shell route #/app/kf-mod-vacations-my-VacationRequest/my/VacationRequest now loads the list and the create form without error. Co-Authored-By: Claude Opus 4.8 --- .../ui/my/my-form-page.js.template | 10 +++++----- .../ui/my/my-list-page.js.template | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/components/template/template-application-ui-harmonia-java/src/main/resources/META-INF/dirigible/template-application-ui-harmonia-java/ui/my/my-form-page.js.template b/components/template/template-application-ui-harmonia-java/src/main/resources/META-INF/dirigible/template-application-ui-harmonia-java/ui/my/my-form-page.js.template index 973470c9f6..ba126385e6 100644 --- a/components/template/template-application-ui-harmonia-java/src/main/resources/META-INF/dirigible/template-application-ui-harmonia-java/ui/my/my-form-page.js.template +++ b/components/template/template-application-ui-harmonia-java/src/main/resources/META-INF/dirigible/template-application-ui-harmonia-java/ui/my/my-form-page.js.template @@ -44,7 +44,7 @@ document.addEventListener('alpine:init', () => { await this.loadOptions(); if (this.id) { try { - const record = await App.api.get(this.apiPath + '/' + this.id); + const record = await App.services.api.get(this.apiPath + '/' + this.id); for (const key of Object.keys(this.form)) { if (record[key] !== undefined && record[key] !== null) this.form[key] = record[key]; } @@ -113,9 +113,9 @@ document.addEventListener('alpine:init', () => { this.error = null; try { if (this.mode === 'edit') { - await App.api.put(this.apiPath + '/' + this.id, this.toPayload()); + await App.services.api.put(this.apiPath + '/' + this.id, this.toPayload()); } else { - await App.api.post(this.apiPath, this.toPayload()); + await App.services.api.post(this.apiPath, this.toPayload()); } this.goBack(); } catch (e) { @@ -128,7 +128,7 @@ document.addEventListener('alpine:init', () => { async confirmDelete() { this.deleteBusy = true; try { - await App.api.del(this.apiPath + '/' + this.id); + await App.services.api.delete(this.apiPath + '/' + this.id); this.deleteOpen = false; this.goBack(); } catch (e) { @@ -167,7 +167,7 @@ document.addEventListener('alpine:init', () => { async loadChildren() { for (const child of this.children) { try { - child.rows = await App.api.get(child.apiPath + '?' + encodeURIComponent(child.fkProperty) + '=' + encodeURIComponent(this.id)) || []; + child.rows = await App.services.api.get(child.apiPath + '?' + encodeURIComponent(child.fkProperty) + '=' + encodeURIComponent(this.id)) || []; if (child.calendar) child.calCfg = { view: child.calendar.view, events: this.buildEvents(child) }; child.state = 'default'; } catch (e) { diff --git a/components/template/template-application-ui-harmonia-java/src/main/resources/META-INF/dirigible/template-application-ui-harmonia-java/ui/my/my-list-page.js.template b/components/template/template-application-ui-harmonia-java/src/main/resources/META-INF/dirigible/template-application-ui-harmonia-java/ui/my/my-list-page.js.template index 2419399f83..3a2a3ff31d 100644 --- a/components/template/template-application-ui-harmonia-java/src/main/resources/META-INF/dirigible/template-application-ui-harmonia-java/ui/my/my-list-page.js.template +++ b/components/template/template-application-ui-harmonia-java/src/main/resources/META-INF/dirigible/template-application-ui-harmonia-java/ui/my/my-list-page.js.template @@ -26,7 +26,7 @@ document.addEventListener('alpine:init', () => { async load() { this.state = 'loading'; try { - this.items = await App.api.get(this.apiPath) || []; + this.items = await App.services.api.get(this.apiPath) || []; this.state = this.items.length ? 'default' : 'empty'; } catch (e) { this.error = (e && e.message) || 'Could not load your ${menuLabel}.';