Skip to content

Commit

Permalink
Image bug fix
Browse files Browse the repository at this point in the history
Changing the directory of where images are located to fix the bug of nonfunctional avatar pictures outside of the home page.
  • Loading branch information
JamalG16 committed Feb 16, 2018
1 parent 98edc7b commit e35b1ce
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 3 additions & 1 deletion static/src/components/body/LoginBox/ChooseAvatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { Component } from 'react'
import { Image, Modal, Button } from 'react-bootstrap'
import { fetchAPI } from '../../utility'
import { updateUser } from '../../../store/auth'
import { Profile } from '../Profile/Profile'

class ChooseAvatar extends Component {

Expand Down Expand Up @@ -38,6 +39,7 @@ class ChooseAvatar extends Component {
let updatedUser = JSON.parse(JSON.stringify(this.props.user))
updatedUser.display_image = data.display_image
updateUser(updatedUser)
this.updateProfileCard()
}
}).catch((e) => console.error("Error:", e))
}
Expand All @@ -59,7 +61,7 @@ class ChooseAvatar extends Component {
}

render() {
let avatarPath = "images/avatar/" + this.state.rand + ".png";
let avatarPath = "\\images/avatar/" + this.state.rand + ".png";
return (
<Modal className="avatarChange" show={this.props.show} onHide={this.closeModal.bind(this)}>
<Modal.Header closeButton>
Expand Down
4 changes: 2 additions & 2 deletions static/src/components/body/LoginBox/ProfileCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ class Profile extends Component {
}
let avatarPath;
if (this.props.user.display_image !== ""){
avatarPath = "images\\avatar\\" + this.props.user.display_image;
avatarPath = "\\images\\avatar\\" + this.props.user.display_image;
} else {
avatarPath = "images\\avatar\\4.png";
avatarPath = "\\images\\avatar\\4.png";
}


Expand Down
5 changes: 2 additions & 3 deletions static/src/components/header/Headermenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import fontawesome from 'react-fontawesome'
class Headermenu extends Component {



render() {
let comp;
let points = {
Expand All @@ -17,9 +16,9 @@ class Headermenu extends Component {
let avatarPath;

if (this.props.user.display_image !== ""){
avatarPath = "images\\avatar\\" + this.props.user.display_image;
avatarPath = "\\images\\avatar\\" + this.props.user.display_image;
} else {
avatarPath = "images\\avatar\\4.png";
avatarPath = "\\images\\avatar\\4.png";
}

if (!(Object.keys(this.props.user).length === 0 && this.props.user.constructor === Object)) { //if the user is connected
Expand Down

0 comments on commit e35b1ce

Please sign in to comment.