Skip to content

Commit

Permalink
Format document
Browse files Browse the repository at this point in the history
  • Loading branch information
SandraBergstrom committed Jun 30, 2023
1 parent e524b7c commit 90c7fa4
Showing 1 changed file with 35 additions and 29 deletions.
64 changes: 35 additions & 29 deletions src/pages/travelers/TravelerEditForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,8 @@ const TravelerEditForm = () => {
one_important_thing: "",
});

const {
name,
content,
image,
favorite_place,
one_important_thing,
} = travelerData;
const { name, content, image, favorite_place, one_important_thing } =
travelerData;

const [errors, setErrors] = useState({});

Expand All @@ -48,8 +43,15 @@ const TravelerEditForm = () => {
if (currentUser?.traveler_id?.toString() === id) {
try {
const { data } = await axiosReq.get(`/travelers/${id}/`);
const { name, content, image, favorite_place, one_important_thing } = data;
setTravelerData({ name, content, image, favorite_place, one_important_thing });
const { name, content, image, favorite_place, one_important_thing } =
data;
setTravelerData({
name,
content,
image,
favorite_place,
one_important_thing,
});
} catch (err) {
console.log(err);
history.push("/");
Expand Down Expand Up @@ -113,31 +115,35 @@ const TravelerEditForm = () => {
</Alert>
))}
<Form.Group>
<Form.Label className="mt-3">What is your favorite place on earth?</Form.Label>
<Form.Control
type="text"
value={favorite_place}
onChange={handleChange}
name="favorite_place"
/>
<Form.Label className="mt-3">
If you could only pack one thing on your next trip, what would
it be?
</Form.Label>
<Form.Control
type="text"
value={one_important_thing}
onChange={handleChange}
name="one_important_thing"
/>
</Form.Group>
<Form.Label className="mt-3">
What is your favorite place on earth?
</Form.Label>
<Form.Control
type="text"
value={favorite_place}
onChange={handleChange}
name="favorite_place"
/>
<Form.Label className="mt-3">
If you could only pack one thing on your next trip, what would it be?
</Form.Label>
<Form.Control
type="text"
value={one_important_thing}
onChange={handleChange}
name="one_important_thing"
/>
</Form.Group>
<Button
className={`mt-3 me-1 ${btnStyles.Button} ${btnStyles.Bright}`}
onClick={() => history.goBack()}
>
cancel
</Button>
<Button className={`mt-3 ms-1 ${btnStyles.Button} ${btnStyles.Blue}`} type="submit">
<Button
className={`mt-3 ms-1 ${btnStyles.Button} ${btnStyles.Blue}`}
type="submit"
>
save
</Button>
</>
Expand Down Expand Up @@ -181,7 +187,7 @@ const TravelerEditForm = () => {
}}
/>
</Form.Group>

<div className="d-md-none">{textFields}</div>
</Container>
</Col>
Expand Down

0 comments on commit 90c7fa4

Please sign in to comment.