Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/src/components/ItemDisplayComp.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ItemDisplayComp extends React.Component {
}

componentDidMount() {
var self = this;
let self = this;
axios
.get("api/items")
.then(function(response) {
Expand Down
13 changes: 6 additions & 7 deletions client/src/components/NavBarComp.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ class NavBarComp extends Component {
</div>
);
}
displayNavs() {
if (this.props.userName) {
return (
displayNavs =()=> {
(this.props.userName) ?
(
<ul className="navbar-nav ml-auto">
<li>
<a href="#" className="nav-link">{this.props.userName}</a>
Expand All @@ -50,9 +50,8 @@ class NavBarComp extends Component {
</button>
</li>
</ul>
);
} else {
return (
)
: (
<ul className="navbar-nav ml-auto">
<li className="nav-item">
<a className="nav-link" href="#/login">
Expand All @@ -66,7 +65,7 @@ class NavBarComp extends Component {
</li>
</ul>
);
}

}
}

Expand Down
9 changes: 4 additions & 5 deletions client/src/components/RegisterFormComp.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@ import ReactDOM from "react-dom";
class RegisterFormComp extends Component {
constructor(props) {
super(props);
this.state = {};
this.onValuChange = this.onValuChange.bind(this);
this.onSubmit = this.onSubmit.bind(this);
this.state = {}

}

onValuChange(e) {
onValuChange =(e)=>{
this.setState({ [e.target.name]: e.target.value });
}

onSubmit(e) {
onSubmit=(e)=> {
var message = "";
e.preventDefault();

Expand Down
7 changes: 3 additions & 4 deletions client/src/components/item/AddItemComp.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ class AddItemComp extends Component {
constructor(props) {
super(props);
this.state = { name: "", description: "", price: "", file: "" };
this.onValueChange = this.onValueChange.bind(this);
this.onSubmit = this.onSubmit.bind(this);

}

onValueChange(e) {
onValueChange= (e)=> {
switch (e.target.name) {
case "file":
this.setState({ file: e.target.files[0] });
Expand All @@ -20,7 +19,7 @@ class AddItemComp extends Component {
}
}

onSubmit(e) {
onSubmit = (e) =>{
e.preventDefault();
let formData = new FormData();
const { name, description, price, file } = this.state;
Expand Down
10 changes: 4 additions & 6 deletions client/src/components/item/EditItemComp.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ import { Redirect } from "react-router-dom";
class LoginFormComp extends Component {
constructor(props) {
super(props);
this.state = {};
this.onValuChange = this.onValuChange.bind(this);
this.onSubmit = this.onSubmit.bind(this);
this.state = {}
}

onValuChange(e) {
onValuChange=(e) =>{
this.setState({ [e.target.name]: e.target.value });
}

onSubmit(e) {
onSubmit=(e) => {
e.preventDefault();
console.log(this.state);
//console.log(this.state);
Expand Down Expand Up @@ -42,7 +40,7 @@ class LoginFormComp extends Component {
}

componentDidMount() {
var self = this;
let self = this;
axios
.get("api/items/" + this.props.itemId)
.then(function(res) {
Expand Down
8 changes: 4 additions & 4 deletions client/src/components/item/ItemDes.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ class ItemDes extends Component {
owner: {},
__v: 0
}; */
this.onDeleteClick = this.onDeleteClick.bind(this);

}

componentDidMount() {}

displayEdit() {
displayEdit =()=> {
const user = sessionStorage.getItem("user");
const { item } = this.props;
if (user) {
Expand All @@ -40,7 +40,7 @@ class ItemDes extends Component {
);
}

onDeleteClick(e) {
onDeleteClick = (e) => {
e.preventDefault();
axios
.delete("/api/items/" + this.state._id, {
Expand Down Expand Up @@ -80,7 +80,7 @@ class ItemDes extends Component {
<br />

<br />
<div id="action">{this.displayEdit()}</div>
<div id="action">{this.displayEdit}</div>
</div>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

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