mirror of
https://github.com/myfatemi04/wheelshare-frontend.git
synced 2025-04-16 00:50:18 -04:00
fix the individual pool page
This commit is contained in:
parent
65085f39bd
commit
ec834c8f7f
|
@ -2,7 +2,6 @@ import { BrowserRouter, Route, Switch } from 'react-router-dom';
|
||||||
import Nav from './components/Nav';
|
import Nav from './components/Nav';
|
||||||
|
|
||||||
import Group from './components/Group';
|
import Group from './components/Group';
|
||||||
import Pool from './components/Pool';
|
|
||||||
import Profile from './components/Profile';
|
import Profile from './components/Profile';
|
||||||
import CreateGroup from './components/CreateGroup';
|
import CreateGroup from './components/CreateGroup';
|
||||||
import Groups from './components/Groups';
|
import Groups from './components/Groups';
|
||||||
|
@ -16,6 +15,7 @@ import './App.css';
|
||||||
import Authenticator from './components/Authenticator';
|
import Authenticator from './components/Authenticator';
|
||||||
import AuthenticationWrapper from './components/AuthenticationWrapper';
|
import AuthenticationWrapper from './components/AuthenticationWrapper';
|
||||||
import Logout from './components/Logout';
|
import Logout from './components/Logout';
|
||||||
|
import PoolPage from './components/PoolPage';
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
return (
|
return (
|
||||||
|
@ -29,7 +29,7 @@ function App() {
|
||||||
<Route component={MyGroups} path="/mygroups" />
|
<Route component={MyGroups} path="/mygroups" />
|
||||||
<Route component={UpdatePool} path="/update_pool" />
|
<Route component={UpdatePool} path="/update_pool" />
|
||||||
<Route component={Group} path="/groups/:id" />
|
<Route component={Group} path="/groups/:id" />
|
||||||
<Route component={Pool} path="/pools/:id" />
|
<Route component={PoolPage} path="/pools/:id" />
|
||||||
<Route component={Groups} path="/groups" />
|
<Route component={Groups} path="/groups" />
|
||||||
<Route component={Profile} path="/profile" />
|
<Route component={Profile} path="/profile" />
|
||||||
<Route component={Logout} path="/logout" />
|
<Route component={Logout} path="/logout" />
|
||||||
|
|
|
@ -87,9 +87,7 @@ export function makeAPIGetCall(
|
||||||
export function makeAPIDeleteCall(url: string) {
|
export function makeAPIDeleteCall(url: string) {
|
||||||
return new Promise<AxiosResponse>((resolve, reject) => {
|
return new Promise<AxiosResponse>((resolve, reject) => {
|
||||||
axios
|
axios
|
||||||
.delete(url, {
|
.delete(url, { headers: { Authorization: 'Bearer ' + getSessionId() } })
|
||||||
headers: { Authorization: 'Bearer ' + getSessionId() },
|
|
||||||
})
|
|
||||||
.then((successfulResponse) => resolve(successfulResponse))
|
.then((successfulResponse) => resolve(successfulResponse))
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
if (error.response?.status === 401) {
|
if (error.response?.status === 401) {
|
||||||
|
|
|
@ -46,9 +46,9 @@ export default function Pool({
|
||||||
pool: Carpool.Pool;
|
pool: Carpool.Pool;
|
||||||
triggerUpdate: Function;
|
triggerUpdate: Function;
|
||||||
}) {
|
}) {
|
||||||
|
console.log(pool);
|
||||||
const { user } = useContext(AuthenticationContext);
|
const { user } = useContext(AuthenticationContext);
|
||||||
const [address, setAddress] = useState('');
|
const [address, setAddress] = useState('');
|
||||||
const [comment, setComment] = useState('');
|
|
||||||
const handleChange = (address: string) => {
|
const handleChange = (address: string) => {
|
||||||
setAddress(address);
|
setAddress(address);
|
||||||
};
|
};
|
||||||
|
@ -88,7 +88,7 @@ export default function Pool({
|
||||||
setCommentStatus('errored');
|
setCommentStatus('errored');
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
[]
|
[pool._id, triggerUpdate]
|
||||||
);
|
);
|
||||||
|
|
||||||
const onRegister = useCallback(() => {
|
const onRegister = useCallback(() => {
|
||||||
|
|
|
@ -17,5 +17,9 @@ export default function PoolPage() {
|
||||||
|
|
||||||
useEffect(() => fetchData(), [fetchData]);
|
useEffect(() => fetchData(), [fetchData]);
|
||||||
|
|
||||||
return pool ? <Pool pool={pool} triggerUpdate={fetchData} /> : null;
|
if (pool != null) {
|
||||||
|
return <Pool pool={pool} triggerUpdate={fetchData} />;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user