Changed the way the base_href is resolved in the frontend, fixing the reload issue.

This commit is contained in:
Roger Far 2024-04-09 20:41:21 -06:00
parent 575ae6af5a
commit acb57dc1ea
2 changed files with 22 additions and 4 deletions

View file

@ -1,4 +1,4 @@
<!DOCTYPE html> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
@ -6,9 +6,11 @@
<base href="/" /> <base href="/" />
<script> <script>
(function () { (function () {
if (window.location.host !== 'localhost:4200') { var baseElement = document.querySelector("base");
var pathSegment = window.location.pathname.split("/")[1];
window["_app_base"] = pathSegment ? "/" + pathSegment + "/" : "/"; if (baseElement) {
var hrefValue = baseElement.getAttribute("href");
window["_app_base"] = hrefValue;
console.log("setting base href to " + window["_app_base"]); console.log("setting base href to " + window["_app_base"]);
} }
})(); })();

View file

@ -1,5 +1,12 @@
{ {
"$schema": "http://json.schemastore.org/launchsettings.json", "$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:6501/test"
}
},
"profiles": { "profiles": {
"RdtClient.Web": { "RdtClient.Web": {
"commandName": "Project", "commandName": "Project",
@ -7,6 +14,15 @@
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
}, },
"applicationUrl": "http://localhost:6500" "applicationUrl": "http://localhost:6500"
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"BASE_PATH": "test"
}
} }
} }
} }