Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #61 from mirmirmirr/env-support
Browse files Browse the repository at this point in the history
Add .env Support
  • Loading branch information
jzgom067 authored Dec 10, 2024
2 parents 5bd86a9 + dbb6ab1 commit 110547d
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 14 deletions.
10 changes: 5 additions & 5 deletions src/pages/Availability.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export default function Availability() {
} else {
try {
const response = await fetch(
'http://tomeeto.cs.rpi.edu:8000/create_guest'
import.meta.env.VITE_API_HOST + '/create_guest'
);
if (response.ok) {
const responseData = await response.json();
Expand Down Expand Up @@ -171,7 +171,7 @@ export default function Availability() {

// Proceed with fetch after check_user completes
const response = await fetch(
'http://tomeeto.cs.rpi.edu:8000/event_details',
import.meta.env.VITE_API_HOST + '/event_details',
{
method: 'POST',
headers: {
Expand Down Expand Up @@ -398,7 +398,7 @@ export default function Availability() {

try {
const response = await fetch(
'http://tomeeto.cs.rpi.edu:8000/update_availability',
import.meta.env.VITE_API_HOST + '/update_availability',
{
method: 'POST',
headers: {
Expand Down Expand Up @@ -427,7 +427,7 @@ export default function Availability() {
credentials.guest_id = parseInt(guestEmail);
credentials.guest_password = guestPW;
} else {
await fetch('http://tomeeto.cs.rpi.edu:8000/create_guest', {
await fetch(import.meta.env.VITE_API_HOST + '/create_guest', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
Expand All @@ -445,7 +445,7 @@ export default function Availability() {
}
try {
const response = await fetch(
'http://tomeeto.cs.rpi.edu:8000/add_availability',
import.meta.env.VITE_API_HOST + '/add_availability',
{
method: 'POST',
headers: {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/CreateEvent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export default function CreateEvent() {
} else {
try {
const response = await fetch(
'http://tomeeto.cs.rpi.edu:8000/create_guest'
import.meta.env.VITE_API_HOST + '/create_guest'
);
if (response.ok) {
const responseData = await response.json();
Expand Down Expand Up @@ -221,7 +221,7 @@ export default function CreateEvent() {

try {
const response = await fetch(
'http://tomeeto.cs.rpi.edu:8000/create_event',
import.meta.env.VITE_API_HOST + '/create_event',
{
method: 'POST',
headers: {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const check_user = async (dataToUse) => {
} else {
try {
const response = await fetch(
'http://tomeeto.cs.rpi.edu:8000/create_guest'
import.meta.env.VITE_API_HOST + '/create_guest'
);
if (response.ok) {
const responseData = await response.json();
Expand Down Expand Up @@ -126,7 +126,7 @@ export default function Dashboard() {

try {
const response = await fetch(
'http://tomeeto.cs.rpi.edu:8000/dashboard_events',
import.meta.env.VITE_API_HOST + '/dashboard_events',
{
method: 'POST',
headers: {
Expand Down
3 changes: 2 additions & 1 deletion src/pages/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ export default function Login() {
document.cookie = passwordCookie;

try {
const response = await fetch('http://tomeeto.cs.rpi.edu:8000/login', {
console.log(import.meta.env.VITE_API_HOST);
const response = await fetch(import.meta.env.VITE_API_HOST + '/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down
6 changes: 3 additions & 3 deletions src/pages/Results.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const check_user = async (dataToUse) => {
} else {
try {
const response = await fetch(
'http://tomeeto.cs.rpi.edu:8000/create_guest'
import.meta.env.VITE_API_HOST + '/create_guest'
);
if (response.ok) {
const responseData = await response.json();
Expand Down Expand Up @@ -91,7 +91,7 @@ export default function Result() {
check_user(credentials);

// First, fetch event details
fetch('http://tomeeto.cs.rpi.edu:8000/event_details', {
fetch(import.meta.env.VITE_API_HOST + '/event_details', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down Expand Up @@ -216,7 +216,7 @@ export default function Result() {

try {
const response = await fetch(
'http://tomeeto.cs.rpi.edu:8000/get_results',
import.meta.env.VITE_API_HOST + '/get_results',
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Signup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default function Signup() {
};

try {
const response = await fetch('http://tomeeto.cs.rpi.edu:8000/signup', {
const response = await fetch(import.meta.env.VITE_API_HOST + '/signup', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down

0 comments on commit 110547d

Please sign in to comment.