Skip to content

Commit

Permalink
Merge pull request #6 from krismosk/en
Browse files Browse the repository at this point in the history
En
  • Loading branch information
krismosk authored Dec 18, 2019
2 parents 2a419ea + 7e3ce33 commit 74dda4c
Show file tree
Hide file tree
Showing 25 changed files with 716 additions and 7 deletions.
212 changes: 212 additions & 0 deletions package-lock.json

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

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.4.0",
"axios": "^0.19.0",
"bootstrap": "^4.4.1",
"react": "^16.8.6",
Expand Down
12 changes: 12 additions & 0 deletions src/components/Customer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';

const Customer = ({ id, name, address, city, state, postalCode, phone, findCustomer }) => {

Expand All @@ -16,4 +17,15 @@ const Customer = ({ id, name, address, city, state, postalCode, phone, findCusto
)
}

Customer.propTypes = {
findCustomer: PropTypes.func.isRequired,
id: PropTypes.number.isRequired,
name: PropTypes.string.isRequired,
address: PropTypes.string,
city: PropTypes.string,
state: PropTypes.string,
postalCode: PropTypes.string,
phone: PropTypes.string,
}

export default Customer;
10 changes: 8 additions & 2 deletions src/components/CustomerList.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { Component } from 'react';
import Customer from './Customer.js';
import axios from 'axios';
import PropTypes from 'prop-types';

class CustomerList extends React.Component {
constructor(props) {
Expand All @@ -12,17 +13,18 @@ class CustomerList extends React.Component {
}

componentDidMount () {
axios.get('http://localhost:3000/customers')
axios.get('http://localhost:3003/customers')
.then((response) => {
this.setState({
customers: response.data,
});
})
.catch((error) => {
console.log('error');
console.log(error.message);
});
}


findCustomer = (customerId) => {
const selectedCustomer = this.state.customers.find((customer) => {
return customer.id === customerId;
Expand Down Expand Up @@ -58,4 +60,8 @@ class CustomerList extends React.Component {
}
}

CustomerList.propTypes = {
selectCustomer: PropTypes.func.isRequired
}

export default CustomerList;
1 change: 0 additions & 1 deletion src/components/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class Home extends React.Component {
}

selectMovie = (movie) => {
console.log('MOVIE SHOULD BE HERE')
this.setState({
selectedMovie: movie
});
Expand Down
Loading

0 comments on commit 74dda4c

Please sign in to comment.