diff --git a/onestopshop/src/Components/ProductCard.js b/onestopshop/src/Components/ProductCard.js index 66301ec..1b962db 100644 --- a/onestopshop/src/Components/ProductCard.js +++ b/onestopshop/src/Components/ProductCard.js @@ -7,12 +7,14 @@ const ProductCard = ({ product }) => { return (
- {product.name} + + {product.name} +
@@ -21,7 +23,6 @@ const ProductCard = ({ product }) => {

{product.price} KWD

-
); diff --git a/onestopshop/src/Components/Profile.js b/onestopshop/src/Components/Profile.js index 3a18daf..36946ca 100644 --- a/onestopshop/src/Components/Profile.js +++ b/onestopshop/src/Components/Profile.js @@ -6,7 +6,6 @@ import Loading from "./Loading"; import Logout from "./Logout"; class Profile extends Component { - componentDidMount() { this.props.fetchProfile(); } @@ -25,27 +24,28 @@ class Profile extends Component { if (!user) return ; if (user) { - if (!loading) { + if (loading) { return ; } else { - console.log("hi", profile.user); + console.log("Profile: ", profile); + console.log("Profile user =>", profile.user); return (
-

Username:

-

First Name:

-

Last Name:

+

Username: {profile.user.username}

+

First Name: {profile.user.first_name}

+

Last Name: {profile.user.last_name}

Age: {profile.age}

Gender: {this.genderString(profile.gender)}

Phone: {profile.phone}

-
+
); @@ -54,15 +54,12 @@ class Profile extends Component { } } - const mapStateToProps = state => ({ user: state.authReducer.user, profile: state.authReducer.profile, - loading: state.profileReducer.loading + loading: state.authReducer.loading }); - - const mapDispatchToProps = dispatch => ({ fetchProfile: () => dispatch(actionCreators.profile()) }); @@ -71,4 +68,3 @@ export default connect( mapStateToProps, mapDispatchToProps )(Profile); - diff --git a/onestopshop/src/redux/actions/instance.js b/onestopshop/src/redux/actions/instance.js index 77d3639..4413345 100644 --- a/onestopshop/src/redux/actions/instance.js +++ b/onestopshop/src/redux/actions/instance.js @@ -1,7 +1,7 @@ import axios from "axios"; const instance = axios.create({ - baseURL: "http://127.0.0.1:8000/api/" + baseURL: "http://134.209.242.76/api/" }); export default instance; diff --git a/onestopshop/src/redux/reducers/authentication.js b/onestopshop/src/redux/reducers/authentication.js index 0e5082e..b7a5142 100644 --- a/onestopshop/src/redux/reducers/authentication.js +++ b/onestopshop/src/redux/reducers/authentication.js @@ -2,7 +2,8 @@ import * as actionTypes from "../actions/actionTypes"; const initialState = { user: null, - profile: {} + profile: null, + loading: true }; const reducer = (state = initialState, action) => { @@ -17,7 +18,8 @@ const reducer = (state = initialState, action) => { const profile = action.payload; return { ...state, - profile: profile + profile: profile, + loading: false }; default: return state;