diff --git a/src/components/CreatePool.tsx b/src/components/CreatePool.tsx index 04172e2..d1c9aca 100644 --- a/src/components/CreatePool.tsx +++ b/src/components/CreatePool.tsx @@ -1,6 +1,16 @@ import { FormEventHandler } from 'react'; +import { makeAPIPostCall } from '../api/utils'; +import React, { useState, useEffect } from 'react'; const CreatePool = () => { + const [title, setTitle] = useState('No Title'); + const [capacity, setCapacity] = useState(0); + const [start, setStart] = useState(''); + const [end, setEnd] = useState(''); + const [direction, setDirection] = useState('pickup'); + const [type, setType] = useState('offer'); + const [description, setDescription] = useState(''); + const onSubmit: FormEventHandler = (e) => { e.preventDefault(); @@ -10,6 +20,27 @@ const CreatePool = () => { 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, + start_time: start, + end_time: end, + capacity, + direction, + type, + }); + }; + useEffect(() => {}, []); return (
{ name="title" className="form-control d-flex" placeholder="Enter title here..." + onChange={(event) => setTitle(event.target.value)} >
@@ -44,7 +76,8 @@ const CreatePool = () => { id="capacity" name="capacity" className="form-control d-flex" - placeholder="5" + placeholder="0" + onChange={(event) => setCapacity(parseInt(event.target.value))} >
@@ -57,6 +90,7 @@ const CreatePool = () => { name="pool_start" className="form-control" placeholder="" + onChange={(event) => setStart(event.target.value)} >
@@ -69,13 +103,41 @@ const CreatePool = () => { name="pool_end" className="form-control" placeholder="Enter text here..." + onChange={(event) => setEnd(event.target.value)} >
+
+ + +
+
+ + +