Skip to content

Commit

Permalink
Merge pull request #18 from Lambda-Build-Week-Water-My-Plants-II/isaa…
Browse files Browse the repository at this point in the history
…c-stott

feat: clean up code, delete console logs
  • Loading branch information
Istott authored Dec 4, 2020
2 parents 9988ace + c1b6ba6 commit 1e7e153
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 54 deletions.
92 changes: 56 additions & 36 deletions wmp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions wmp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"axios": "^0.19.2",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-redux": "^7.2.0",
"react": "^16.14.0",
"react-dom": "^16.14.0",
"react-redux": "^7.2.2",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.1",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0",
"yup": "^0.29.1"
"yup": "^0.29.3"
},
"scripts": {
"start": "react-scripts start",
Expand Down
1 change: 0 additions & 1 deletion wmp/src/actions/PlantAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export const getPlant = userId => dispatch => {
axiosWithAuth()
.get(`/api/plants/`)
.then(res => {
console.log('get', res)
dispatch({ type: FETCH_PLANT_SUCCESS, payload: res.data });
})
.catch(error =>
Expand Down
7 changes: 3 additions & 4 deletions wmp/src/components/AddPlantPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@ const AddPlant = props => {
const handleSelectChanges = e => {
const valueSelected = e.target.value;
setPlant({ ...plant, [e.target.name]: valueSelected });
console.log('fluffy', e.target.name, valueSelected, plant);

};

const handleChanges = e => {
setPlant({ ...plant, [e.target.name]: e.target.value });
console.log(plant);

};


const submitForm = e => {
e.preventDefault();
console.log(plant);


if(props.isEditing === true){
props.editPlant(props.plantToEdit.id, plant)
Expand All @@ -55,7 +55,6 @@ const AddPlant = props => {
axiosWithAuth()
.post(`/api/plants/`, plant)
.then(res => {
console.log(res)
history.push("/home");
})
.catch(err => console.log(err));
Expand Down
1 change: 0 additions & 1 deletion wmp/src/components/LoginForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ const LoginForm = (props) => {
axiosWithAuth()
.post('/api/auth/login', userCredentials)
.then(res => {
console.log(res);
props.setUserId(res.data.id);
window.localStorage.setItem("token", res.data.token);
window.localStorage.setItem("userId", res.data.id);
Expand Down
3 changes: 1 addition & 2 deletions wmp/src/components/NavBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const Navbar = () => {
axiosWithAuth()
.get('/api/user')
.then(res => {
console.log('getuser', res.data.username)
setName(res.data.username)
})
.catch(err => console.log(err))
Expand All @@ -41,7 +40,7 @@ const Navbar = () => {
<div className="NavBar">
<h1>Water My Plants</h1>

<h3>Welcome {name} <div className="kiwi"> &#129373;</div></h3>
<h3>Welcome {name} <div className="kiwi"><span role='img' aria-label='kiwi'> &#129373;</span> </div></h3>


<div className='linky'>
Expand Down
1 change: 0 additions & 1 deletion wmp/src/components/PlantCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { getPlant, deletePlant, startEdit } from '../actions/PlantAction'


const PlantCard = props => {
// console.log('plantcardy', props)

const {push} = useHistory();

Expand Down
7 changes: 3 additions & 4 deletions wmp/src/components/PlantCardList.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { connect } from 'react-redux';
import { getPlant } from '../actions/PlantAction'

const PlantCardList = props => {
console.log('plantcardlist', props)

return (
<div className='plantList'>
Expand All @@ -22,13 +21,13 @@ const PlantCardList = props => {
))}
</div>

: (<h2>No Plants &#127793;</h2>)}
: (<h2>No Plants <span role='img' aria-label='checked'>&#127793;</span></h2>)}
</div>
) : (
<h2>Fetching Plants ... &#127793;</h2>
<h2>Fetching Plants ... <span role='img' aria-label='checked'>&#127793;</span></h2>
)
) : (
<h2>Welcome! Add A Plant To Begin &#127793;</h2>
<h2>Welcome! Add A Plant To Begin <span role='img' aria-label='checked'>&#127793;</span></h2>
)}
</div>
);
Expand Down
1 change: 0 additions & 1 deletion wmp/src/components/RegistrationForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ const RegistrationForm = (props) => {
axiosWithAuth()
.post('/api/auth/register', userCredentials)
.then(res => {
console.log(res)
history.push("/");
})
.catch( err => console.log(err) );
Expand Down

0 comments on commit 1e7e153

Please sign in to comment.