diff --git a/index.html b/index.html index 98dcfbb..82ce2e1 100644 --- a/index.html +++ b/index.html @@ -2,10 +2,10 @@ - + - Vite + React + TS + Wander | Explora nuevas aventuras diff --git a/public/favicon.svg b/public/favicon.svg new file mode 100644 index 0000000..61c7673 --- /dev/null +++ b/public/favicon.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/components/ConfirmRegister/ConfirmRegister.tsx b/src/components/ConfirmRegister/ConfirmRegister.tsx index bbc3a70..8c61dea 100644 --- a/src/components/ConfirmRegister/ConfirmRegister.tsx +++ b/src/components/ConfirmRegister/ConfirmRegister.tsx @@ -24,13 +24,22 @@ const ConfirmRegister = () => { } else { setResendEnabled(true); // Habilitar el botón de reenviar cuando los 60 segundos se hayan agotado } + + // return () => localStorage.removeItem("tempEmail") }, [timeLeft]); - const handleResend = () => { + const handleResend = async () => { setTimeLeft(60); // Resetear cuenta regresiva setResendEnabled(false); // Deshabilitar el botón hasta pasar otros 60 segundos // Lógica para reenviar el código - console.log("Código reenviado."); + const email = localStorage.getItem("tempEmail") + + try { + const res = await authServices.resendCode(email!) + console.log(res) + } catch (error) { + console.log(error) + } }; const handleSubmit = async (e: React.FormEvent) => { @@ -43,9 +52,9 @@ const ConfirmRegister = () => { } try { - const res = await authServices.confirmAccount({ email: tempEmail, verificationCode: code }) - console.log(res) - localStorage.removeItem("tempEmail") + await authServices.confirmAccount({ email: tempEmail, verificationCode: code }) + // console.log(res) + // localStorage.removeItem("tempEmail") setShowModal(true); // Si el código es válido, mostramos el modal de éxito } catch (error) { if(error instanceof AxiosError) { @@ -85,6 +94,7 @@ const ConfirmRegister = () => { // Función para redirigir a la página de login const handleLoginRedirect = () => { + localStorage.removeItem("tempEmail") navigate("/login"); // Redirigir al login }; diff --git a/src/components/ExperienceDetail/ExperienceDetail.tsx b/src/components/ExperienceDetail/ExperienceDetail.tsx index d784e13..7d0cf50 100644 --- a/src/components/ExperienceDetail/ExperienceDetail.tsx +++ b/src/components/ExperienceDetail/ExperienceDetail.tsx @@ -21,7 +21,7 @@ function ExperienceDetail() { {} as DetailExperience ); - const [isLoading, setIsLoading] = useState(false); + const [isLoading, setIsLoading] = useState(true); useEffect(() => { const reservation = localStorage.getItem("reservation") @@ -67,6 +67,7 @@ function ExperienceDetail() {
{/* Seccion de imagenes (Posible slider u otra forma de mostrar las imagenes) */} diff --git a/src/components/ExperienceDetail/ImageCardExperience.tsx b/src/components/ExperienceDetail/ImageCardExperience.tsx index 0458188..a76a2dd 100644 --- a/src/components/ExperienceDetail/ImageCardExperience.tsx +++ b/src/components/ExperienceDetail/ImageCardExperience.tsx @@ -1,11 +1,11 @@ -import exampleImage from "../../assets/exampleImage.png"; +// import exampleImage from "../../assets/exampleImage.png"; import { Swiper, SwiperSlide } from "swiper/react"; import { Pagination } from "swiper/modules"; import "swiper/css"; import "swiper/css/pagination"; -function ImageCardExperience({title, rating} : {title: string, rating: number}) { - const photos = [exampleImage, exampleImage, exampleImage]; +function ImageCardExperience({title, rating, images} : {title: string, rating: number, images: string[]}) { + // const photos = [exampleImage, exampleImage, exampleImage]; const getRating = (rating: number) => { switch (rating) { @@ -22,7 +22,6 @@ function ImageCardExperience({title, rating} : {title: string, rating: number}) } }; - return (
- {photos.map((photo, index) => ( + {images.map((photo, index) => ( {title} -

{getRating(rating)?.stars} 10 Reviews

+

{getRating(rating)?.stars} {/* 10 Reviews */}

))} diff --git a/src/components/ExperienceDetail/ReviewCard.tsx b/src/components/ExperienceDetail/ReviewCard.tsx index 726c2e0..3071d22 100644 --- a/src/components/ExperienceDetail/ReviewCard.tsx +++ b/src/components/ExperienceDetail/ReviewCard.tsx @@ -13,6 +13,8 @@ interface IReview { function ReviewCard({review} : {review: IReview}) { const { rating, comment, createdAt, userName, userAvatar } = review; + const userImage = "https://medvirturials.com/img/default-image.png" + console.log(review) const getRating = (rating: number) => { @@ -34,7 +36,7 @@ function ReviewCard({review} : {review: IReview}) { return (
- +

{userName ?? "Usuario"}

{getRating(rating)?.stars} {formatToShortDate(createdAt)}

diff --git a/src/components/Filters/Filters.tsx b/src/components/Filters/Filters.tsx index 29bebf1..51029e5 100644 --- a/src/components/Filters/Filters.tsx +++ b/src/components/Filters/Filters.tsx @@ -266,7 +266,7 @@ const Filters: React.FC = () => { > {experience.title}
diff --git a/src/components/Home/homePage.tsx b/src/components/Home/homePage.tsx index 99825e3..c91e82c 100644 --- a/src/components/Home/homePage.tsx +++ b/src/components/Home/homePage.tsx @@ -132,7 +132,7 @@ const Home: React.FC = () => {
@@ -164,7 +164,7 @@ const Home: React.FC = () => { ultimaLlamadaExperiences.map((experience) => (
handleImageClick(experience.id)}> {experience.title} diff --git a/src/components/UserProfile/UserProfile.tsx b/src/components/UserProfile/UserProfile.tsx index 09f112b..6a5c3a5 100644 --- a/src/components/UserProfile/UserProfile.tsx +++ b/src/components/UserProfile/UserProfile.tsx @@ -1,4 +1,4 @@ -import { useState, useEffect } from "react" +import { useState, useEffect, useContext } from "react" import userServices from "../../services/user.services" import { userInitialValues } from "../../consts/userInitialValues" @@ -8,11 +8,13 @@ import DetailsCard from "./DetailsCard" import Logout from "../Logout" import AddExperienceButton from "./AddExperienceButton" import { useLocation } from "react-router-dom"; +import { AuthContext } from "../../contexts/auth.context" const UserProfile: React.FC = () => { const path = useLocation(); + const { user } = useContext(AuthContext) const [userInfo, setUserInfo] = useState(userInitialValues) const loadUserInfo = async () => { @@ -36,14 +38,14 @@ const UserProfile: React.FC = () => { const { email, location, name, phone, role } = userInfo const userImage = "https://medvirturials.com/img/default-image.png" - + console.log(userInfo) return (
{role.toUpperCase() === 'PROVIDER' && ( diff --git a/src/services/auth.services.ts b/src/services/auth.services.ts index 32d7fbc..7b6fd7e 100644 --- a/src/services/auth.services.ts +++ b/src/services/auth.services.ts @@ -36,6 +36,10 @@ class AuthServices { logout(token: string) { return this.api.post('/logout', null, { headers: { Authorization: `Bearer ${token}` } }); } + + async resendCode(email: string) { + return this.api.post("/resend-code", { email }) + } } const authServices = new AuthServices() diff --git a/src/types/detailexperience.ts b/src/types/detailexperience.ts index b4921fc..acca663 100644 --- a/src/types/detailexperience.ts +++ b/src/types/detailexperience.ts @@ -10,5 +10,6 @@ export interface DetailExperience { rating: number, capacity: number, createdAt: string, - status: boolean + status: boolean, + experienceImages: string[] } \ No newline at end of file diff --git a/src/types/experience.ts b/src/types/experience.ts index 48bfe9d..e8d7f8e 100644 --- a/src/types/experience.ts +++ b/src/types/experience.ts @@ -10,5 +10,6 @@ export interface IExperience { rating: number; capacity: number; createdAt: Date; + experienceImages: string[] }