Skip to content

Commit 1cb502f

Browse files
committed
frontend: add configurable base url for app links. fix #106
1 parent b7b4e61 commit 1cb502f

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

frontend/.env.local.example

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
VITE_BACKEND_URL=https://host/api
22
VITE_BACKEND_WS_URL=wss://host/api
3-
4-
TEST_USER = Testuser
5-
TEST_PASSWORD = Testpass
3+
VITE_FRONTEN_URL=https://host
4+
TEST_USER=Testuser
5+
TEST_PASSWORD=Testpass

frontend/src/components/Navbar.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { useLocation } from "preact-iso";
22
import Nav from "react-bootstrap/Nav";
3-
import { BACKEND } from "../utils";
3+
import { BACKEND, FRONTEN_URL } from "../utils";
44
import { useTranslation } from "react-i18next";
5-
import { Button, Container, Navbar, Row } from "react-bootstrap";
6-
import { connected, connected_to } from "./charger_list";
5+
import { Navbar } from "react-bootstrap";
6+
import { connected } from "./charger_list";
77
import Median from "median-js-bridge";
88
import i18n from "../i18n";
99

@@ -18,12 +18,12 @@ export async function logout(logout_all: boolean) {
1818
export function setAppNavigation() {
1919
const items = [{
2020
label: i18n.t("navbar.chargers"),
21-
url: "https://mystaging.warp-charger.com/chargers",
21+
url: `${FRONTEN_URL}/chargers`,
2222
icon: "fas fa-server"
2323
},
2424
{
2525
label: i18n.t("navbar.user"),
26-
url: "https://mystaging.warp-charger.com/user",
26+
url: `${FRONTEN_URL}/user`,
2727
icon: "fas fa-user"
2828
}]
2929
Median.sidebar.setItems({items: items, enabled: true, persist: true});

frontend/src/utils.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,4 @@ export const loggedIn = signal(AppState.Loading);
6969

7070
export const PASSWORD_PATTERN = /(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}/;
7171
export const BACKEND = import.meta.env.VITE_BACKEND_URL;
72+
export const FRONTEN_URL = import.meta.env.VITE_FRONTEND_URL;

0 commit comments

Comments
 (0)