From 411c932e8cb6b19eacb229236c9c7eac3d48bb1e Mon Sep 17 00:00:00 2001 From: rcmenno <129762469+rcmenno@users.noreply.github.com> Date: Mon, 14 Oct 2024 10:58:09 +0200 Subject: [PATCH] Leverage more templates bump 0.3.0 --- PWA/package.json | 2 +- .../FetchEventHandlers/UploadDataHandler.js | 3 +- PWA/public/index.html | 2 +- PWA/public/upload_data.html | 119 ++---------------- PWA/public/upload_error.html | 117 ++--------------- .../FetchEventHandlers/UploadDataHandler.ts | 3 +- 6 files changed, 30 insertions(+), 216 deletions(-) diff --git a/PWA/package.json b/PWA/package.json index 296bcf5..d0e48a8 100644 --- a/PWA/package.json +++ b/PWA/package.json @@ -1,6 +1,6 @@ { "name": "ReliefBox", - "version": "0.2.0", + "version": "0.3.0", "description": "A tool for managing the distribution of relief items during humanitarian emergencies.", "main": "index.js", "scripts": { diff --git a/PWA/public/Services/FetchEventHandlers/UploadDataHandler.js b/PWA/public/Services/FetchEventHandlers/UploadDataHandler.js index b8d07be..2ff1cc2 100644 --- a/PWA/public/Services/FetchEventHandlers/UploadDataHandler.js +++ b/PWA/public/Services/FetchEventHandlers/UploadDataHandler.js @@ -1,9 +1,10 @@ import { RouteEvents } from "../../RouteEvents.js"; +import { ResponseTools } from "../ResponseTools.js"; export class UploadDataHandler { canHandleEvent(event) { return event.request.url.endsWith("/upload_data?"); } async handleEvent(event) { - return fetch(RouteEvents.uploadData); + return ResponseTools.wrapInHtmlTemplate(RouteEvents.uploadData); } } diff --git a/PWA/public/index.html b/PWA/public/index.html index 2556584..a1db876 100644 --- a/PWA/public/index.html +++ b/PWA/public/index.html @@ -39,7 +39,7 @@ - +
- -
-
- -
- - - - - -
-
-
- - - -
- -
-
- -
-
- - -
-
-
-
- -
- -
-
- - - \ No newline at end of file + + + \ No newline at end of file diff --git a/PWA/public/upload_error.html b/PWA/public/upload_error.html index 2a6ca5e..39804f2 100644 --- a/PWA/public/upload_error.html +++ b/PWA/public/upload_error.html @@ -1,106 +1,13 @@ - - - - - - - - - ReliefBox - - - - - - -
- - - -
-
- -
- - - - - -
-
-
- -
-
- -
-
-
- -
-
-
-
+
+
+ +
+
+ +
+
+
+ +
- -
- -
-
- - - \ No newline at end of file + \ No newline at end of file diff --git a/PWA/src/Services/FetchEventHandlers/UploadDataHandler.ts b/PWA/src/Services/FetchEventHandlers/UploadDataHandler.ts index ed0c4e1..c8df88c 100644 --- a/PWA/src/Services/FetchEventHandlers/UploadDataHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/UploadDataHandler.ts @@ -1,6 +1,7 @@ import { RouteEvents } from "../../RouteEvents.js"; import { FetchEvent } from "../../Interfaces/FetchEvent.js"; import { FetchEventHandler } from "../../Interfaces/FetchEventHandler.js"; +import { ResponseTools } from "../ResponseTools.js"; export class UploadDataHandler implements FetchEventHandler { canHandleEvent(event: FetchEvent): boolean { @@ -8,6 +9,6 @@ export class UploadDataHandler implements FetchEventHandler { } async handleEvent(event: FetchEvent): Promise { - return fetch(RouteEvents.uploadData) + return ResponseTools.wrapInHtmlTemplate(RouteEvents.uploadData) } }