From 4430843abf36cbe1201cc0a7f3d3ca5a26e287da Mon Sep 17 00:00:00 2001 From: Bryant Le Date: Mon, 6 Nov 2023 12:53:10 -0600 Subject: [PATCH] update tutor names --- src/pages/Tutoring/Tutoring.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/pages/Tutoring/Tutoring.js b/src/pages/Tutoring/Tutoring.js index 7e18b656..8dc2113c 100644 --- a/src/pages/Tutoring/Tutoring.js +++ b/src/pages/Tutoring/Tutoring.js @@ -1,4 +1,3 @@ -import axios from 'axios'; import React from 'react'; import { Col, Container, Row, Button } from 'react-bootstrap'; import headerImage from '../../assets/tutoring.svg'; @@ -15,11 +14,15 @@ const meta = { img: 'https://i.ibb.co/NTLFrdj/cougarcs-background11.jpg', }; -const url = `${process.env.REACT_APP_API_URL}/api/tutors`; +const url = + process.env.NODE_ENV === 'development' + ? 'http://localhost:3000' + : 'https://api.cougarcs.com'; const fetchTutors = async () => { - const res = await axios.get(url); - return res.data.tutors; + const res = await fetch(url + '/v1/tutors/names'); + const { data } = await res.json(); + return data; }; const Tutoring = () => { @@ -28,7 +31,6 @@ const Tutoring = () => { initialData: () => queryClient.getQueryData('tutors'), staleTime: 300000, }); - const displayTutors = () => { return isFetching ? ( @@ -45,7 +47,7 @@ const Tutoring = () => { ) : ( -
{val.name}
+
{val.first_name + ' ' + val.last_name}
) ) );