From ffb920cb0d1d8bc2e261d4f0b01585d32c2fdbd4 Mon Sep 17 00:00:00 2001 From: Nadav Tasher Date: Sat, 27 Jan 2024 21:57:27 +0200 Subject: [PATCH] Minor bug fixes --- .gitignore | 3 ++- image/src/backend/router.py | 4 +++- image/src/frontend/modules/api/module.js | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index c75a201..89f9dbc 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -image/Dockerfile-* \ No newline at end of file +image/Dockerfile-* +image/Dockerfile \ No newline at end of file diff --git a/image/src/backend/router.py b/image/src/backend/router.py index 5dd8ffd..7dd4fd0 100644 --- a/image/src/backend/router.py +++ b/image/src/backend/router.py @@ -67,8 +67,10 @@ def wrapper(**kwargs): # Create error response from exception return str(exception), 500 + # Decide the endpoint name + endpoint = options.pop("endpoint", rule + repr(options.get("methods"))) + # Register the wrapper function - endpoint = options.pop("endpoint", None) self.add_url_rule(rule, endpoint, wrapper, **options) # Return the original function diff --git a/image/src/frontend/modules/api/module.js b/image/src/frontend/modules/api/module.js index 13a3ce1..b292d43 100644 --- a/image/src/frontend/modules/api/module.js +++ b/image/src/frontend/modules/api/module.js @@ -2,8 +2,11 @@ class API { static async call(action, parameters = {}) { // Execute request using fetch const response = await fetch(`api/${action}`, { - method: "post", + method: "POST", body: JSON.stringify(parameters), + headers: { + "Content-Type": "application/json", + }, }); // Check response status code