diff --git a/.env-default b/.env-default new file mode 100644 index 0000000..cd41370 --- /dev/null +++ b/.env-default @@ -0,0 +1 @@ +VITE_API_URL=http://localhost:3000 \ No newline at end of file diff --git a/.gitignore b/.gitignore index 609f659..c9f4466 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ tmp/ frontend/dist static/modern .python-version +.env \ No newline at end of file diff --git a/README.md b/README.md index 256d60d..5513cdb 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ poetry shell pre-commit install python manage.py migrate bin/run +cp .env-default .env # in another terminal cd frontend diff --git a/frontend/src/client.ts b/frontend/src/client.ts index a3bfa2b..51ff67e 100644 --- a/frontend/src/client.ts +++ b/frontend/src/client.ts @@ -1,7 +1,7 @@ import { ApolloClient, InMemoryCache } from "@apollo/client"; const client = new ApolloClient({ - uri: import.meta.env.VITE_API_URL || "http://localhost:8000/graphql/", + uri: `${import.meta.env.VITE_API_URL}/graphql/`, cache: new InMemoryCache(), }); diff --git a/frontend/src/components/Header.tsx b/frontend/src/components/Header.tsx index f327e3a..99a857d 100644 --- a/frontend/src/components/Header.tsx +++ b/frontend/src/components/Header.tsx @@ -8,9 +8,7 @@ import { NavLink } from "react-router-dom"; import { ReactComponent as Logo } from "../assets/brick.svg"; import styles from "./Header.module.css"; -const ADMIN_URL = import.meta.env.VITE_API_URL - ? `${import.meta.env.VITE_API_URL}/admin` - : "http://localhost:8000/admin/"; +const ADMIN_URL = `${import.meta.env.VITE_API_URL}/admin`; const navLinkStyles = ({ isActive }: { isActive: boolean }) => (isActive ? "nav-link active" : "nav-link");