Skip to content

Conversation

@sagar23sj
Copy link
Collaborator

Created Add_Driver UI File
Pivotal Id : [#171205845]

Comment on lines +24 to +32
fetch('http://localhost:4000/users', {
method: 'POST',
headers: {
Accept: 'application/cab-tab.com; version=1',
'Content-Type': 'application/json',
},
body: JSON.stringify(user),
}).then((response) => { console.log(response); });
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should generic handler for api calling, ApiHelper which would contain wrapper over fetch.
Please remover log if its not logged purposefully

<br />

<div className="row">
<InputGroup className="col-sm-12">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it require to wrap input into input group all time

import { Button, InputGroup, Input} from 'reactstrap';

function Add_Driver() {
const [driverFirstName, setDriverFirstName] = useState('');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make it one object say driverDetailObject and add generic handler.

import React, { useState } from 'react';
import 'bootstrap/dist/css/bootstrap.min.css';
import './component.css';
import { Button, InputGroup, Input} from 'reactstrap';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move component/library imports at top.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants