From 61a018895751a4e3ebbfe08fc54988b82f00ddae Mon Sep 17 00:00:00 2001 From: Nadav Tasher Date: Thu, 1 Feb 2024 16:26:34 +0200 Subject: [PATCH] Relative / Absolute path fixes --- image/src/frontend/modules/api/module.js | 2 +- image/src/frontend/template/template.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/image/src/frontend/modules/api/module.js b/image/src/frontend/modules/api/module.js index b292d43..7d4d7f4 100644 --- a/image/src/frontend/modules/api/module.js +++ b/image/src/frontend/modules/api/module.js @@ -1,7 +1,7 @@ class API { static async call(action, parameters = {}) { // Execute request using fetch - const response = await fetch(`api/${action}`, { + const response = await fetch(`/api/${action}`, { method: "POST", body: JSON.stringify(parameters), headers: { diff --git a/image/src/frontend/template/template.js b/image/src/frontend/template/template.js index f8a35e7..4f9549e 100644 --- a/image/src/frontend/template/template.js +++ b/image/src/frontend/template/template.js @@ -11,7 +11,7 @@ class Module { // Create a script element const element = document.createElement("script"); element.id = `script:${name}`; - element.src = `modules/${name}/module.js`; + element.src = `/modules/${name}/module.js`; // Make sure script is not already loaded if (document.getElementById(element.id)) { @@ -50,7 +50,7 @@ class Module { } // Try fetching the HTML resource - const response = await fetch(`modules/${name}/module.html`); + const response = await fetch(`/modules/${name}/module.html`); const resources = await response.text(); // Check if already exists