diff --git a/studentbyer/components/StudentCityCards/StudentCityCard.tsx b/studentbyer/components/StudentCityCards/StudentCityCard.tsx index 97d9655d5a6557e8455a799c17e14998f4d5ffe4..3e6c44cb32ed84ad1bd265262fd6e9aecfa1fcef 100644 --- a/studentbyer/components/StudentCityCards/StudentCityCard.tsx +++ b/studentbyer/components/StudentCityCards/StudentCityCard.tsx @@ -3,7 +3,10 @@ import { StudentCity } from "../../store/studentCity/interfaces"; import { Text, View } from "../Themed"; import { Badge } from "react-native-elements"; import { useActions } from "../../hooks/useActions"; -import { setStudentCity } from "../../store/studentCity/actions"; +import { + fetchStudentCity, + setStudentCity, +} from "../../store/studentCity/actions"; import { TouchableOpacity } from "react-native-gesture-handler"; import Rating from "../Rating"; import StarRating from "../Rating/StarRating"; @@ -17,13 +20,13 @@ type Props = { * Component for showing data for one student city given as a prop. */ const StudentCityCard = ({ studentCity, navigation }: Props) => { - const actions = useActions({ setStudentCity }); + const actions = useActions({ fetchStudentCity }); return ( <TouchableOpacity key={studentCity.id} onPress={() => { - actions.setStudentCity(studentCity); // don't need to fetch again here + actions.fetchStudentCity(studentCity.id); // don't need to fetch again here navigation.navigate("StudentCity"); }} >