Skip to content
Snippets Groups Projects
Commit ac57faca authored by Jørgen Rosager's avatar Jørgen Rosager
Browse files

change to proper action

parent 79f038e2
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,10 @@ import { StudentCity } from "../../store/studentCity/interfaces"; ...@@ -3,7 +3,10 @@ import { StudentCity } from "../../store/studentCity/interfaces";
import { Text, View } from "../Themed"; import { Text, View } from "../Themed";
import { Badge } from "react-native-elements"; import { Badge } from "react-native-elements";
import { useActions } from "../../hooks/useActions"; 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 { TouchableOpacity } from "react-native-gesture-handler";
import Rating from "../Rating"; import Rating from "../Rating";
import StarRating from "../Rating/StarRating"; import StarRating from "../Rating/StarRating";
...@@ -17,13 +20,13 @@ type Props = { ...@@ -17,13 +20,13 @@ type Props = {
* Component for showing data for one student city given as a prop. * Component for showing data for one student city given as a prop.
*/ */
const StudentCityCard = ({ studentCity, navigation }: Props) => { const StudentCityCard = ({ studentCity, navigation }: Props) => {
const actions = useActions({ setStudentCity }); const actions = useActions({ fetchStudentCity });
return ( return (
<TouchableOpacity <TouchableOpacity
key={studentCity.id} key={studentCity.id}
onPress={() => { 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"); navigation.navigate("StudentCity");
}} }}
> >
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment