From 5e2f141324d4e5599f574abd4ed8fae540c884bb Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Mon, 26 Dec 2022 01:04:14 +0100 Subject: [PATCH] fixed token not being correctly passed from get_token to the feedback function --- webclient/config.js | 4 ++-- webclient/src/feedback.js | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/webclient/config.js b/webclient/config.js index 5dce38257..011ae815c 100644 --- a/webclient/config.js +++ b/webclient/config.js @@ -13,6 +13,6 @@ export const configRelease = { export const configLocal = { app_prefix: "", - cdn_prefix: "/cdn/", - api_prefix: "http://localhost:8080/api/", + cdn_prefix: "https://nav.tum.de/cdn/", + api_prefix: "https://nav.tum.de/api/", }; diff --git a/webclient/src/feedback.js b/webclient/src/feedback.js index 2e47419b2..71ccb9f31 100644 --- a/webclient/src/feedback.js +++ b/webclient/src/feedback.js @@ -60,7 +60,7 @@ window.feedback = (() => { if (r.status === 201) { token = { creation: Date.now(), - value: JSON.parse(r.response).token, + value: r.response.replace(/^"(.*)"$/, '$1'), }; if (navigatum) navigatum.setLocalStorageWithExpiry("feedback-token", token, 6); @@ -170,6 +170,9 @@ window.feedback = (() => { const invalidTokenError = "${{_.feedback.error.send_invalid_token}}$"; _showError(`${invalidTokenError} (${r.responseText})`, false); } else { + // we reset the token here to be sure that it is the cause of the error + localStorage.removeItem("feedback-token"); + token = null; const unexpectedStatusError = "${{_.feedback.error.send_unexpected_status}}$"; _showError(`${unexpectedStatusError}${r.status}`, false);