use relative locations

This commit is contained in:
SrGooglo 2024-02-16 02:02:08 +01:00
parent be51e638e5
commit 406a10e3c5
2 changed files with 15 additions and 5 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "rs-bundler", "name": "rs-bundler",
"version": "0.13.0", "version": "0.13.1",
"description": "RageStudio Bundler Utility GUI", "description": "RageStudio Bundler Utility GUI",
"main": "./out/main/index.js", "main": "./out/main/index.js",
"author": "RageStudio", "author": "RageStudio",

View File

@ -64,9 +64,15 @@ const NavigationController = (props) => {
} }
} }
app.location.path = to app.location.last = {
path: app.location.path,
search: app.location.search,
state: app.location.state,
}
app.location.last = window.location app.location.search = to.includes("?") ? to.split("?")[1] : ""
app.location.state = state
app.location.path = to
document.startViewTransition(() => { document.startViewTransition(() => {
navigate(to, { navigate(to, {
@ -76,7 +82,7 @@ const NavigationController = (props) => {
} }
async function backLocation() { async function backLocation() {
return setLocation(app.location.last.pathname + app.location.last.search, app.location.last.state) return setLocation(app.location.last.path + app.location.last.search, app.location.last.state)
} }
function pushToListeners(listener) { function pushToListeners(listener) {
@ -91,7 +97,11 @@ const NavigationController = (props) => {
React.useEffect(() => { React.useEffect(() => {
app.location = { app.location = {
last: window.location, last: {
path: "/",
search: "",
state: {},
},
path: "/", path: "/",
listeners: [], listeners: [],
listen: pushToListeners, listen: pushToListeners,