From 97f7a6e4efe0342305f4eb79ac3286837401701c Mon Sep 17 00:00:00 2001 From: Simon Larsen Date: Tue, 19 Dec 2023 17:23:53 +0000 Subject: [PATCH] Add webpack-dev-server for development environment --- Accounts/Dockerfile.tpl | 2 ++ AdminDashboard/Dockerfile.tpl | 1 + CommonServer/API/StatusPageAPI.ts | 6 +++++- CommonUI/src/Utils/ModelAPI/ModelAPI.ts | 2 +- Dashboard/Dockerfile.tpl | 1 + StatusPage/Dockerfile.tpl | 1 + StatusPage/src/Pages/Subscribe/UpdateSubscription.tsx | 3 ++- 7 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Accounts/Dockerfile.tpl b/Accounts/Dockerfile.tpl index a1ae354df5..2a3d9da223 100644 --- a/Accounts/Dockerfile.tpl +++ b/Accounts/Dockerfile.tpl @@ -74,6 +74,8 @@ RUN npm i -D webpack-cli {{ if eq .Env.ENVIRONMENT "development" }} RUN mkdir /usr/src/app/dev-env RUN touch /usr/src/app/dev-env/.env +RUN npm i -D webpack-dev-server + #Run the app CMD [ "npm", "run", "dev" ] {{ else }} diff --git a/AdminDashboard/Dockerfile.tpl b/AdminDashboard/Dockerfile.tpl index 40a2719ea4..25a0e09888 100644 --- a/AdminDashboard/Dockerfile.tpl +++ b/AdminDashboard/Dockerfile.tpl @@ -73,6 +73,7 @@ RUN npm i -D webpack-cli #Run the app RUN mkdir /usr/src/app/dev-env RUN touch /usr/src/app/dev-env/.env +RUN npm i -D webpack-dev-server CMD [ "npm", "run", "dev" ] {{ else }} # Copy app source diff --git a/CommonServer/API/StatusPageAPI.ts b/CommonServer/API/StatusPageAPI.ts index 7dbdfe797c..ff9926996b 100644 --- a/CommonServer/API/StatusPageAPI.ts +++ b/CommonServer/API/StatusPageAPI.ts @@ -1134,7 +1134,6 @@ export default class StatusPageAPI extends BaseAPI< ) => { try { await this.subscribeToStatusPage(req); - return Response.sendEmptyResponse(req, res); } catch (err) { next(err); @@ -1957,6 +1956,11 @@ export default class StatusPageAPI extends BaseAPI< } if (isUpdate) { + + // check isUnsubscribed is set to false. + + statusPageSubscriber.isUnsubscribed = req.body.data['isUnsubscribed'] ? true : false; + await StatusPageSubscriberService.updateOneById({ id: statusPageSubscriber.id!, data: statusPageSubscriber, diff --git a/CommonUI/src/Utils/ModelAPI/ModelAPI.ts b/CommonUI/src/Utils/ModelAPI/ModelAPI.ts index 1cb3038401..f3d0c4a712 100644 --- a/CommonUI/src/Utils/ModelAPI/ModelAPI.ts +++ b/CommonUI/src/Utils/ModelAPI/ModelAPI.ts @@ -141,7 +141,7 @@ export default class ModelAPI { ? HTTPMethod.POST : HTTPMethod.PUT; - if (httpMethod === HTTPMethod.PUT) { + if (httpMethod === HTTPMethod.PUT && !data.requestOptions?.overrideRequestUrl) { apiUrl = apiUrl.addRoute(`/${data.model._id}`); } diff --git a/Dashboard/Dockerfile.tpl b/Dashboard/Dockerfile.tpl index c811a4292d..cf290b41db 100644 --- a/Dashboard/Dockerfile.tpl +++ b/Dashboard/Dockerfile.tpl @@ -72,6 +72,7 @@ RUN npm i -D webpack-cli #Run the app RUN mkdir /usr/src/app/dev-env RUN touch /usr/src/app/dev-env/.env +RUN npm i -D webpack-dev-server CMD [ "npm", "run", "dev" ] {{ else }} # Copy app source diff --git a/StatusPage/Dockerfile.tpl b/StatusPage/Dockerfile.tpl index 81fe61d75e..884436aaf1 100644 --- a/StatusPage/Dockerfile.tpl +++ b/StatusPage/Dockerfile.tpl @@ -73,6 +73,7 @@ RUN npm i -D webpack-cli {{ if eq .Env.ENVIRONMENT "development" }} RUN mkdir /usr/src/app/dev-env RUN touch /usr/src/app/dev-env/.env +RUN npm i -D webpack-dev-server #Run the app CMD [ "npm", "run", "dev" ] {{ else }} diff --git a/StatusPage/src/Pages/Subscribe/UpdateSubscription.tsx b/StatusPage/src/Pages/Subscribe/UpdateSubscription.tsx index afa83181e6..d8b7163e87 100644 --- a/StatusPage/src/Pages/Subscribe/UpdateSubscription.tsx +++ b/StatusPage/src/Pages/Subscribe/UpdateSubscription.tsx @@ -43,12 +43,13 @@ const SubscribePage: FunctionComponent = ( const updateApiUrl: URL = URL.fromString( URL.fromString(STATUS_PAGE_API_URL.toString()) .addRoute(`/update-subscription/${statusPageId.toString()}`) + .addRoute('/' + statusPageSubscriberId.toString()) .toString() ); const getSubscriptionUrl: URL = URL.fromString( URL.fromString(STATUS_PAGE_API_URL.toString()) - .addRoute(`/get-subscription/${statusPageId.toString()}`) + .addRoute(`/get-subscription/${statusPageId.toString()}`).addRoute('/' + statusPageSubscriberId.toString()) .toString() );