Skip to content

Commit

Permalink
fix: .env in interface folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Valimp committed Feb 5, 2024
1 parent 1cc1be7 commit 9a976a4
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ POSTGRES_DB=postgres
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
# expose postgres on localhost for dev
# POSTGRES_EXPOSE=127.0.0.1:5432
POSTGRES_EXPOSE=127.0.0.1:5432

# The top-level domain used for Open Food Facts,
# it's either `net` (staging) or `org` (production)
Expand Down
8 changes: 8 additions & 0 deletions interface/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Dev Mode
# ---------
VITE_DEVELOPPEMENT_MODE = "development"
# VITE_DEVELOPPEMENT_MODE = ""

# ApiUrl
# ------
VITE_API_URL = "http://localhost:8000"
2 changes: 1 addition & 1 deletion interface/components/ArchiveButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Button from '@mui/material/Button';

// Change status of ticket to archived
function handleArchive(id: number) {
axios.put(`http://localhost:8000/tickets/${id}/status?status=archived`)
axios.put(`${import.meta.env.VITE_API_URL}/tickets/${id}/status?status=archived`)
window.location.reload();
}

Expand Down
2 changes: 1 addition & 1 deletion interface/components/CloseButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Button from '@mui/material/Button';

// Change status of ticket to closed
function handleClose(id: number) {
axios.put(`http://localhost:8000/tickets/${id}/status?status=closed`)
axios.put(`${import.meta.env.VITE_API_URL}/tickets/${id}/status?status=closed`)
window.location.reload();
}

Expand Down
2 changes: 1 addition & 1 deletion interface/pages/ModerationPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function ModerationPage() {

useEffect(() => {
// send get request to api to get tickets and set Tickets to the response
axios.get('http://localhost:8000/tickets').then((res) => {
axios.get(`${import.meta.env.VITE_API_URL}/tickets`).then((res) => {
setTickets(res.data.tickets)
})
}, [])
Expand Down
3 changes: 2 additions & 1 deletion interface/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import NotFound from "../pages/NotFound.tsx";
export default function App() {

// turn in to true to test the moderation page - it will always be logged in
const devMode = false;
const devMode = (import.meta.env.VITE_DEVELOPPEMENT_MODE === "development");


const [userState, setUserState] = useState(() => {
if (devMode) {
Expand Down

0 comments on commit 9a976a4

Please sign in to comment.