From 34f14d6ca848ce6112746cc377d755441a926c6f Mon Sep 17 00:00:00 2001 From: Ruben van der Linde Date: Tue, 12 May 2026 19:06:42 +0200 Subject: [PATCH] fix: route procest API calls through generateUrl() so they work without mod_rewrite MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Several frontend fetches hardcoded /apps/procest/api/... — fine behind Apache+rewrite, but in a bare 'php -S' env (incl. the CI E2E job) that path isn't routable and 404s. Most visibly: the settings store's /api/settings fetch fails in CI, so the dashboard widgets never get configured (all show 'Widget not available') and CnFormDialog opens with an empty form. Wrap the URLs in generateUrl() like the other API services already do: - store/modules/settings.js (/api/settings) - store/modules/zgwMapping.js (/api/zgw-mappings[...]) - views/settings/AdminRoot.vue (/api/settings/load) - views/voorstellen/VoorstelList.vue (/api/notifications/parafering-reminder) --- src/store/modules/settings.js | 5 +++-- src/store/modules/zgwMapping.js | 7 ++++--- src/views/settings/AdminRoot.vue | 3 ++- src/views/voorstellen/VoorstelList.vue | 3 ++- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/store/modules/settings.js b/src/store/modules/settings.js index c4457b9b..0a583b90 100644 --- a/src/store/modules/settings.js +++ b/src/store/modules/settings.js @@ -1,4 +1,5 @@ import { defineStore } from 'pinia' +import { generateUrl } from '@nextcloud/router' export const useSettingsStore = defineStore('settings', { state: () => ({ @@ -23,7 +24,7 @@ export const useSettingsStore = defineStore('settings', { this.error = null try { - const response = await fetch('/apps/procest/api/settings', { + const response = await fetch(generateUrl('/apps/procest/api/settings'), { method: 'GET', headers: { 'Content-Type': 'application/json', @@ -57,7 +58,7 @@ export const useSettingsStore = defineStore('settings', { this.error = null try { - const response = await fetch('/apps/procest/api/settings', { + const response = await fetch(generateUrl('/apps/procest/api/settings'), { method: 'POST', headers: { 'Content-Type': 'application/json', diff --git a/src/store/modules/zgwMapping.js b/src/store/modules/zgwMapping.js index c3ccec41..f2c8a82e 100644 --- a/src/store/modules/zgwMapping.js +++ b/src/store/modules/zgwMapping.js @@ -1,4 +1,5 @@ import { defineStore } from 'pinia' +import { generateUrl } from '@nextcloud/router' export const useZgwMappingStore = defineStore('zgwMapping', { state: () => ({ @@ -17,7 +18,7 @@ export const useZgwMappingStore = defineStore('zgwMapping', { this.error = null try { - const response = await fetch('/apps/procest/api/zgw-mappings', { + const response = await fetch(generateUrl('/apps/procest/api/zgw-mappings'), { method: 'GET', headers: { 'Content-Type': 'application/json', @@ -47,7 +48,7 @@ export const useZgwMappingStore = defineStore('zgwMapping', { this.error = null try { - const response = await fetch(`/apps/procest/api/zgw-mappings/${resourceKey}`, { + const response = await fetch(generateUrl(`/apps/procest/api/zgw-mappings/${resourceKey}`), { method: 'PUT', headers: { 'Content-Type': 'application/json', @@ -78,7 +79,7 @@ export const useZgwMappingStore = defineStore('zgwMapping', { this.error = null try { - const response = await fetch(`/apps/procest/api/zgw-mappings/${resourceKey}/reset`, { + const response = await fetch(generateUrl(`/apps/procest/api/zgw-mappings/${resourceKey}/reset`), { method: 'POST', headers: { 'Content-Type': 'application/json', diff --git a/src/views/settings/AdminRoot.vue b/src/views/settings/AdminRoot.vue index f89b0105..03e358b8 100644 --- a/src/views/settings/AdminRoot.vue +++ b/src/views/settings/AdminRoot.vue @@ -76,6 +76,7 @@ import CaseTypeAdmin from './CaseTypeAdmin.vue' import ZgwMappingSettings from './ZgwMappingSettings.vue' import MapLayerSettings from './MapLayerSettings.vue' import AiSettingsTab from './tabs/AiSettingsTab.vue' +import { generateUrl } from '@nextcloud/router' import { initializeStores } from '../../store/store.js' export default { @@ -112,7 +113,7 @@ export default { this.message = '' try { - const response = await fetch('/apps/procest/api/settings/load', { + const response = await fetch(generateUrl('/apps/procest/api/settings/load'), { method: 'POST', headers: { 'Content-Type': 'application/json', diff --git a/src/views/voorstellen/VoorstelList.vue b/src/views/voorstellen/VoorstelList.vue index 7f88f443..59790d9e 100644 --- a/src/views/voorstellen/VoorstelList.vue +++ b/src/views/voorstellen/VoorstelList.vue @@ -106,6 +106,7 @@ import { NcButton, NcEmptyContent, NcLoadingIcon } from '@nextcloud/vue' import FileDocumentEditOutline from 'vue-material-design-icons/FileDocumentEditOutline.vue' import BellRing from 'vue-material-design-icons/BellRing.vue' import VoorstelCreateDialog from './components/VoorstelCreateDialog.vue' +import { generateUrl } from '@nextcloud/router' import { useObjectStore } from '../../store/modules/object.js' const STATUS_LABELS = { @@ -255,7 +256,7 @@ export default { async sendReminder(voorstel) { const actor = this.getWaitingActor(voorstel) try { - await fetch('/apps/procest/api/notifications/parafering-reminder', { + await fetch(generateUrl('/apps/procest/api/notifications/parafering-reminder'), { method: 'POST', headers: { 'Content-Type': 'application/json',