mirror of
https://github.com/myfatemi04/wheelshare-frontend.git
synced 2025-04-21 19:29:51 -04:00
deleted protected routes
This commit is contained in:
commit
100f2f815f
|
@ -24,8 +24,6 @@ function App() {
|
||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
<Nav />
|
<Nav />
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route component={Signup} path="/register" />
|
|
||||||
<Route component={Signin} path="/login" />
|
|
||||||
<Route component={Main} path="/about" />
|
<Route component={Main} path="/about" />
|
||||||
<Route component={CreatePool} path="/create_pool" />
|
<Route component={CreatePool} path="/create_pool" />
|
||||||
<Route component={CreateGroup} path="/create_group" />
|
<Route component={CreateGroup} path="/create_group" />
|
||||||
|
|
2
src/api.js
Normal file
2
src/api.js
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
const dev = process.env.NODE_ENV === 'development';
|
||||||
|
export const API_ENDPOINT = 'http://localhost/api';
|
|
@ -1,4 +1,5 @@
|
||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
|
import { API_ENDPOINT } from '../api';
|
||||||
|
|
||||||
const Group = (props) => {
|
const Group = (props) => {
|
||||||
const id = props.match.params.id;
|
const id = props.match.params.id;
|
||||||
|
@ -55,20 +56,17 @@ const Group = (props) => {
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
const callAPI = () => {
|
useEffect(() => {
|
||||||
fetch(`${process.env.REACT_APP_API_ENDPOINT}/pools/`)
|
console.log(process.env);
|
||||||
|
fetch(`${API_ENDPOINT}/my_pools`)
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((data) => {
|
.then((json) => {
|
||||||
if (data !== undefined) {
|
if (json) {
|
||||||
setPools(data.Pools);
|
setPools(json.data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
console.log('hello');
|
|
||||||
callAPI();
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const maybePluralize = (count, noun, suffix = 's') =>
|
const maybePluralize = (count, noun, suffix = 's') =>
|
||||||
`${count} ${noun}${count !== 1 ? suffix : ''}`;
|
`${count} ${noun}${count !== 1 ? suffix : ''}`;
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
export default function Main() {
|
||||||
|
return (
|
||||||
|
<div className="d-flex flex-column">
|
||||||
|
<h1>About Us</h1>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
|
@ -2,6 +2,8 @@ import React, { useState, useEffect, useCallback } from 'react';
|
||||||
|
|
||||||
const UpdatePool = (props) => {
|
const UpdatePool = (props) => {
|
||||||
const id = props.match.params.id;
|
const id = props.match.params.id;
|
||||||
|
|
||||||
|
// eslint-disable-next-line
|
||||||
const [pool, setPool] = useState({
|
const [pool, setPool] = useState({
|
||||||
id: 1,
|
id: 1,
|
||||||
pool_title: 'TJ Carpool',
|
pool_title: 'TJ Carpool',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user