Compare commits
7 Commits
add-footer
...
add-anlyti
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4667e612fd | ||
|
|
1d68ce40e7 | ||
|
|
ae256eea91 | ||
|
|
7bad2ab562 | ||
|
|
54b7c92e83 | ||
|
|
39c6957e2f | ||
|
|
4f44af5180 |
@@ -31,3 +31,15 @@ Backend startup quickstart:
|
|||||||
make poller — Builds and runs the poller.
|
make poller — Builds and runs the poller.
|
||||||
make poller-dev — Runs the poller with auto-reload.
|
make poller-dev — Runs the poller with auto-reload.
|
||||||
|
|
||||||
|
## Production: `make build` + restart service
|
||||||
|
|
||||||
|
On the server, from this directory:
|
||||||
|
|
||||||
|
- **`make build`** — writes fresh **`bin/api`** and **`bin/poller`** (see the Makefile).
|
||||||
|
- **`make build-api`** — API only; **`make build-poller`** — poller only.
|
||||||
|
|
||||||
|
Building alone does **not** reload a process that is already listening (e.g. on port 8080). After deploy:
|
||||||
|
|
||||||
|
1. Ensure **`systemctl`** (or your supervisor) **`ExecStart`** runs the binary you just built (e.g. **`.../backend/bin/api`**) or copy `bin/api` to that path.
|
||||||
|
2. **`sudo systemctl restart <your-api-service>`** (and the poller service if you rebuilt it).
|
||||||
|
3. Optional check: **`readlink -f /proc/<pid>/exe`** should show your **`bin/api`** path without **`(deleted)`** — if you see `(deleted)`, an old process is still running the previous binary from memory.
|
||||||
|
|||||||
@@ -1 +1,20 @@
|
|||||||
export const API_BASE = import.meta.env.VITE_API_BASE || "/v1";
|
const DEFAULT_API_BASE = "/v1";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API origin for fetch(): root-relative prefix (e.g. /v1) or absolute URL (https://host/v1).
|
||||||
|
* Root-relative values are forced to start with "/" so requests work from any SPA route
|
||||||
|
* (e.g. /support); otherwise "v1/support" would resolve under the current path and 404.
|
||||||
|
*/
|
||||||
|
function normalizeApiBase(raw) {
|
||||||
|
const s = String(raw ?? "").trim();
|
||||||
|
const base = s || DEFAULT_API_BASE;
|
||||||
|
|
||||||
|
if (/^https?:\/\//i.test(base)) {
|
||||||
|
return base.replace(/\/+$/, "") || DEFAULT_API_BASE;
|
||||||
|
}
|
||||||
|
|
||||||
|
const path = base.startsWith("/") ? base : `/${base}`;
|
||||||
|
return path.replace(/\/+$/, "") || DEFAULT_API_BASE;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const API_BASE = normalizeApiBase(import.meta.env.VITE_API_BASE);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export async function submitSupportRequest({ email, description }) {
|
|||||||
if (data.message) message = data.message;
|
if (data.message) message = data.message;
|
||||||
else if (data.error && res.status) message = `${data.error} (${res.status})`;
|
else if (data.error && res.status) message = `${data.error} (${res.status})`;
|
||||||
} catch {
|
} catch {
|
||||||
message = `Request failed (${res.status}). Is the API running on port 3001?`;
|
message = `Request failed (HTTP ${res.status}). The server did not return JSON — check that POST ${API_BASE}/support is proxied to your Go API (e.g. nginx location /v1/).`;
|
||||||
}
|
}
|
||||||
throw new Error(message);
|
throw new Error(message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,10 +12,12 @@ const navLinks = [
|
|||||||
|
|
||||||
export default function Navbar() {
|
export default function Navbar() {
|
||||||
const { currentUser, logout } = useAuth();
|
const { currentUser, logout } = useAuth();
|
||||||
|
const authData = useAuth();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const [isNavPanelOpen, setIsNavPanelOpen] = useState(false);
|
const [isNavPanelOpen, setIsNavPanelOpen] = useState(false);
|
||||||
|
|
||||||
if (!currentUser) return null;
|
if (!currentUser) return null;
|
||||||
|
console.log(authData)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
Reference in New Issue
Block a user