From 6cd56843b442912d99969681eaf80febb69bf285 Mon Sep 17 00:00:00 2001 From: Michael Fatemi Date: Sat, 10 Apr 2021 21:17:50 -0400 Subject: [PATCH] make pool creation work --- src/components/CreatePool.tsx | 237 ++++++++++++++++------------------ src/components/Group.tsx | 2 +- 2 files changed, 115 insertions(+), 124 deletions(-) diff --git a/src/components/CreatePool.tsx b/src/components/CreatePool.tsx index d1c9aca..64a5c2e 100644 --- a/src/components/CreatePool.tsx +++ b/src/components/CreatePool.tsx @@ -1,6 +1,5 @@ -import { FormEventHandler } from 'react'; import { makeAPIPostCall } from '../api/utils'; -import React, { useState, useEffect } from 'react'; +import { useState, useEffect } from 'react'; const CreatePool = () => { const [title, setTitle] = useState('No Title'); @@ -10,34 +9,18 @@ const CreatePool = () => { const [direction, setDirection] = useState('pickup'); const [type, setType] = useState('offer'); const [description, setDescription] = useState(''); + const [group, setGroup] = useState(''); - const onSubmit: FormEventHandler = (e) => { - e.preventDefault(); - - fetch(`${process.env.REACT_APP_API_ENDPOINT}/createPool`) - .then((response) => response.json()) - .then((data) => { - console.log(data); - }); - }; const onClick = () => { - console.log({ - title: title, - description: description, - start_time: start, - end_time: end, - capacity, - direction, - type, - }); makeAPIPostCall('/pool', { - title: title, - description: description, + title, + description, start_time: start, end_time: end, capacity, direction, type, + group_id: group, }); }; useEffect(() => {}, []); @@ -50,107 +33,115 @@ const CreatePool = () => { className="container card card-body text-left " style={{ backgroundColor: '#F1EAE8' }} > -
-
-

- Create Pool -

- - setTitle(event.target.value)} - > -
-
- - setCapacity(parseInt(event.target.value))} - > -
-
- - setStart(event.target.value)} - > -
-
- - setEnd(event.target.value)} - > -
-
- - -
-
- - -
-
- -