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

View file

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