{
- if (isAuthenticated()) {
- return ;
- } else {
- return (
-
- );
- }
- }}
- />
- );
-};
-
-export default ProtectedRoute;
diff --git a/src/components/UpdatePool.js b/src/components/UpdatePool.js
index 903c204..1742e3d 100644
--- a/src/components/UpdatePool.js
+++ b/src/components/UpdatePool.js
@@ -3,6 +3,7 @@ import React, { useState, useEffect, useCallback } from 'react';
const UpdatePool = (props) => {
const id = props.match.params.id;
const [pool, setPool] = useState({
+ id: 1,
pool_title: 'TJ Carpool',
pool_text: 'Carpool from TJ track to homes',
start_time: '4/10/2021 3:00 PM',
@@ -11,33 +12,19 @@ const UpdatePool = (props) => {
participants: [],
comments: ['What is the covid vaccination status of all the participants?'],
});
- const requestOptions = {
- method: 'GET',
- headers: {
- Authorization: `Bearer ${localStorage.getItem('token')}`,
- },
- };
const callAPI = useCallback(() => {
- fetch(`${process.env.REACT_APP_API_ENDPOINT}/pool/${id}`, requestOptions)
+ fetch(`${process.env.REACT_APP_API_ENDPOINT}/pool/${id}`)
.then((response) => response.json())
.then((data) => {
if (data !== undefined) {
setPool(data);
}
});
- }, [id, requestOptions]);
+ }, [id]);
const onSubmit = (e) => {
e.preventDefault();
- const requestOptions = {
- method: 'Pool',
- headers: {
- 'Content-Type': 'application/json',
- Authorization: `Bearer ${localStorage.getItem('token')}`,
- },
- body: JSON.stringify({ Poolid: props.id }),
- };
- fetch(`${process.env.REACT_APP_API_ENDPOINT}/createPool`, requestOptions)
+ fetch(`${process.env.REACT_APP_API_ENDPOINT}/create_pool`)
.then((response) => response.json())
.then((data) => {
console.log(data);
@@ -58,7 +45,7 @@ const UpdatePool = (props) => {