Commit 2354a586 authored by Lorenzo Trujillo Rojas's avatar Lorenzo Trujillo Rojas
Browse files

Se agregó una pagina generica de error al obtener pueblos y estados

parent 87562138
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -6,9 +6,10 @@ import { Caroussel } from "../../common/components/caroussel/caroussel";
import { router } from "expo-router";
import { useAnimatedSelectedIndex } from "../../hooks/useAnimatedSelectedIndex";
import { AnimatedBackground } from "../../common/components/animated_background";
import { ErrorPage } from "../error_page/error_page";

export const StateSelectionPage = () => {
  const { data, requestStatus } = useGetStates();
  const { data, requestStatus, refresh } = useGetStates();
  const { selectedStateIndex, onIndexChange, backgroundImageAnimation } =
    useAnimatedSelectedIndex(200, 200);

@@ -22,9 +23,7 @@ export const StateSelectionPage = () => {

  if (requestStatus === ApiRequestStatus.ERROR || !data) {
    return (
      <View style={pageStyles.page_container}>
        <Text>Something went wrong</Text>
      </View>
      <ErrorPage refresh={refresh}/>
    );
  }

+3 −4
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ import { useCallback, useState } from "react";
import { useAnimatedSelectedIndex } from "../../hooks/useAnimatedSelectedIndex";
import { AnimatedBackground } from "../../common/components/animated_background";
import BottomSheet, { BottomSheetView } from "@gorhom/bottom-sheet";
import { ErrorPage } from "../error_page/error_page";

interface TownSelectionPageProps {
  stateId: number;
@@ -17,7 +18,7 @@ interface TownSelectionPageProps {
const snapPoints = ["15%", "50%"];

export const TownSelectionPage = ({ stateId }: TownSelectionPageProps) => {
  const { data, requestStatus } = useGetTowns(stateId);
  const { data, requestStatus, refresh } = useGetTowns(stateId);
  const { selectedStateIndex, onIndexChange, backgroundImageAnimation } =
    useAnimatedSelectedIndex(200, 200);

@@ -31,9 +32,7 @@ export const TownSelectionPage = ({ stateId }: TownSelectionPageProps) => {

  if (requestStatus === ApiRequestStatus.ERROR || !data) {
    return (
      <View style={pageStyles.page_container}>
        <Text>Something went wrong</Text>
      </View>
      <ErrorPage refresh={refresh} />
    );
  }