Skip to content

Commit

Permalink
localhost hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
CamPlume1 committed Dec 5, 2024
1 parent 7e94f17 commit 39f6b47
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 11 deletions.
3 changes: 2 additions & 1 deletion frontend/components/Venue/BookmarkButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from "react";
import { View, TouchableOpacity, Image, StyleSheet } from "react-native";
import PropTypes from "prop-types";
import Toast from 'react-native-root-toast'
import { API_DOMAIN } from "@env";

const BookmarkButton = ({ venueID = "", userID = "" }) => {
const bookmarkVenue = async () => {
Expand All @@ -12,7 +13,7 @@ const BookmarkButton = ({ venueID = "", userID = "" }) => {

try {
const response = await fetch(
`http://localhost:8080/bookmarks/${venueID}/${userID}`,
`${API_DOMAIN}/bookmarks/${venueID}/${userID}`,
{
method: "POST",
headers: {
Expand Down
3 changes: 2 additions & 1 deletion frontend/components/Venue/Review.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Text, View, StyleSheet, Image } from "react-native";
import { useEffect, useState } from "react";
import PropTypes from "prop-types";
import { API_DOMAIN } from "@env";

/**
* Used to display reviews on the VenueReviews page. Contains information like overall rating, review summary, and images
Expand Down Expand Up @@ -68,7 +69,7 @@ const Review = ({ reviewDict = {
setHasReviewText(false);
}

fetch(`http://localhost:8080/profiles/${reviewDict.user_id}`)
fetch(`${API_DOMAIN}/profiles/${reviewDict.user_id}`)
.then(response => response.json())
.then(json => {
setUserName(json.username);
Expand Down
3 changes: 2 additions & 1 deletion frontend/components/Venue/VenueRatings.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useState, useEffect } from "react";
import { API_DOMAIN } from "@env";

/**
* Averages all rating info for a specific venue
Expand All @@ -15,7 +16,7 @@ const useVenueRatings = (venueID) => {
const [overallRating, setOverallRating] = useState(5);

useEffect(() => {
fetch(`http://localhost:8080/venueratings/venue/${venueID}/ratings`)
fetch(`${API_DOMAIN}/venueratings/venue/${venueID}/ratings`)
.then((response) => {
if (!response.ok) {
throw new Error("Failed to fetch ratings");
Expand Down
70 changes: 69 additions & 1 deletion frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion frontend/screens/venue/PhotosScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react";
import { View, StyleSheet, SafeAreaView, Image, ScrollView, Text } from "react-native";
import { useEffect, useState } from "react";
import { API_DOMAIN } from "@env";

/**
* Screen to display all photos that have been included in any reviews of the current venue
Expand All @@ -14,7 +15,7 @@ const PhotosScreen: React.FC = ({ venueID }) => {

// get all reviews from a venue
useEffect(() => {
fetch(`http://localhost:8080/venueratings/venue/${venueID}/ratings`)
fetch(`${API_DOMAIN}/venueratings/venue/${venueID}/ratings`)
.then(response => response.json())
.then(json => {
setReviewDictList(json);
Expand Down
3 changes: 2 additions & 1 deletion frontend/screens/venue/RateReviewScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Feather } from "@expo/vector-icons";
import PropTypes from "prop-types";
import stars from "@/components/Venue/Stars";
import Toast from 'react-native-root-toast'
import { API_DOMAIN } from "@env";

type RootStackParamList = {
Home: undefined;
Expand Down Expand Up @@ -81,7 +82,7 @@ const RateReviewScreen: React.FC<ReviewScreenProps> = ({ route, navigation }) =>

try {
const response = await fetch(
`http://localhost:8080/userratings/user/${reviewData.user_id}/${reviewData.venue_id}`,
`${API_DOMAIN}/userratings/user/${reviewData.user_id}/${reviewData.venue_id}`,
{
method: "POST",
headers: {
Expand Down
3 changes: 2 additions & 1 deletion frontend/screens/venue/RatingScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useState } from "react";
import {Text, View, TouchableOpacity, ScrollView, StyleSheet} from "react-native";
import RatingScrollBar from "@/components/Venue/RatingScrollBar";
import Toast from "react-native-root-toast";
import { API_DOMAIN } from "@env";
/**
* Allows a user to submit a rating score for various specific categories
* @param venueId venueId of the venue currently being explored
Expand Down Expand Up @@ -58,7 +59,7 @@ const RatingScreen: React.FC<{ venueId: string, personas: object, hype: number,
};

try {
const response = await fetch(`http://localhost:8080/userratings/user/${userID}/${venueId}`, {
const response = await fetch(`${API_DOMAIN}/userratings/user/${userID}/${venueId}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down
3 changes: 2 additions & 1 deletion frontend/screens/venue/VenueReviews.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from "react";
import { Text, View, StyleSheet, SafeAreaView, Image, TouchableOpacity, ScrollView } from "react-native";
import { useEffect, useState } from "react";
import Review from "@/components/Venue/Review";
import { API_DOMAIN } from "@env";

/**
* Displays a list of all the reviews that users have posted for the given venue containing the text, overall rating
Expand All @@ -24,7 +25,7 @@ const VenueReviews: React.FC = ({ navigation, venueID, venueName, venueAddress,
};

useEffect(() => {
fetch(`http://localhost:8080/venueratings/venue/${venueID}/ratings`)
fetch(`${API_DOMAIN}/venueratings/venue/${venueID}/ratings`)
.then((response) => response.json())
.then((json) => {
setReviewDictList(json);
Expand Down
7 changes: 4 additions & 3 deletions frontend/screens/venue/VenueScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import isCurrentTimeInRange from "@/components/Venue/TimeCheck";
import VenueHeader from "@/components/Venue/VenueScreenHeader";
import RatingScreen from "./RatingScreen";
import PersonaIcons from "@/components/Venue/PersonaIcons";
import { API_DOMAIN } from "@env";

enum VenueTabs {
Overview = "Overview",
Expand Down Expand Up @@ -66,7 +67,7 @@ const VenueScreen: React.FC = ({ navigation, route }) => {

// GET venue information -> name, address, type
useEffect(() => {
fetch(`http://localhost:8080/venues/${venueID}`)
fetch(`${API_DOMAIN}/venues/${venueID}`)
.then(response => response.json())
.then(json => {
setVenueName(json.name);
Expand All @@ -91,7 +92,7 @@ const VenueScreen: React.FC = ({ navigation, route }) => {

// GET venue events -> all columns
useEffect(() => {
fetch(`http://localhost:8080/event/${venueID}`)
fetch(`${API_DOMAIN}/event/${venueID}`)
.then(response => response.json())
.then(json => {
setEventDictList(json);
Expand All @@ -102,7 +103,7 @@ const VenueScreen: React.FC = ({ navigation, route }) => {
}, []);

useEffect(() => {
fetch(`http://localhost:8080/venues/persona/${venueID}`)
fetch(`${API_DOMAIN}/venues/persona/${venueID}`)
.then((response) => {
if (!response.ok) {
throw new Error('Failed to fetch personas');
Expand Down

0 comments on commit 39f6b47

Please sign in to comment.