diff --git a/Makefile b/Makefile index dcd2fa9..4edcb71 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,8 @@ all: setup build .PHONY: setup setup: cp -n .env.dev .env - cp -n .env.dev server/.env + ln -sf ../.env client/.env + ln -sf ../.env server/.env mkdir -p dist/ $(MAKE) -C server setup diff --git a/client/Makefile b/client/Makefile index b9f9413..9bd00bf 100644 --- a/client/Makefile +++ b/client/Makefile @@ -5,9 +5,9 @@ all: setup build .PHONY: setup setup: mkdir -p dist/ - npm install .PHONY: build build: + npm install npm run build diff --git a/client/package.json b/client/package.json index fe1fe51..a11476a 100644 --- a/client/package.json +++ b/client/package.json @@ -5,7 +5,7 @@ "main": "index.js", "scripts": { "dev": "vite", - "build": "vite build --base=/posti-dm", + "build": "vite build", "preview": "vite preview" }, "keywords": [], diff --git a/client/src/pages/login.js b/client/src/pages/login.js index 467c2a2..967a451 100644 --- a/client/src/pages/login.js +++ b/client/src/pages/login.js @@ -50,7 +50,7 @@ async function login() { return } - location.href = '/' + location.href = `${import.meta.env.BASE_URL}` } catch (e) { displayErrorString(e) } @@ -64,7 +64,7 @@ async function main() { const user = await getLoggedUser() console.log(user) if (user) { - location.href = '/' + location.href = `${import.meta.env.BASE_URL}` } elLoginButton.addEventListener('click', () => login()) diff --git a/server/main.go b/server/main.go index 0475a4c..96276c7 100644 --- a/server/main.go +++ b/server/main.go @@ -34,7 +34,7 @@ func main() { // FIXME: Route temporanea, basta configurare ViteJS per bene r.Get("/login.html", func(w http.ResponseWriter, r *http.Request) { - http.Redirect(w, r, "/login", http.StatusTemporaryRedirect) + http.Redirect(w, r, config.Url+"/login", http.StatusTemporaryRedirect) }) }