@@ -115,4 +119,8 @@ AddEducation.propTypes = {
addEducation: PropTypes.func.isRequired
};
-export default connect(null, { addEducation })(AddEducation);
\ No newline at end of file
+<<<<<<< HEAD
+export default connect(null, { addEducation })(AddEducation);
+=======
+export default connect(null, { addEducation })(AddEducation);
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
diff --git a/client/src/components/profile-forms/AddExperience.js b/client/src/components/profile-forms/AddExperience.js
index 8549f8d..af37bdf 100644
--- a/client/src/components/profile-forms/AddExperience.js
+++ b/client/src/components/profile-forms/AddExperience.js
@@ -33,7 +33,11 @@ const AddExperience = ({ addExperience }) => {
className="form"
onSubmit={(e) => {
e.preventDefault();
+<<<<<<< HEAD
+ addExperience(formData).then(() => navigate('/dashboard'));
+=======
addExperience(formData, navigate);
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
}}
>
@@ -116,4 +120,8 @@ AddExperience.propTypes = {
addExperience: PropTypes.func.isRequired
};
-export default connect(null, { addExperience })(AddExperience);
\ No newline at end of file
+<<<<<<< HEAD
+export default connect(null, { addExperience })(AddExperience);
+=======
+export default connect(null, { addExperience })(AddExperience);
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
diff --git a/client/src/components/profile-forms/ProfileForm.js b/client/src/components/profile-forms/ProfileForm.js
index dfe5c3c..9189d18 100644
--- a/client/src/components/profile-forms/ProfileForm.js
+++ b/client/src/components/profile-forms/ProfileForm.js
@@ -78,8 +78,16 @@ const ProfileForm = ({
setFormData({ ...formData, [e.target.name]: e.target.value });
const onSubmit = (e) => {
+<<<<<<< HEAD
+ const editing = profile ? true : false;
+ e.preventDefault();
+ createProfile(formData, editing).then(() => {
+ if (!editing) navigate('/dashboard');
+ });
+=======
e.preventDefault();
createProfile(formData, navigate, profile ? true : false);
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
};
return (
@@ -273,4 +281,8 @@ const mapStateToProps = (state) => ({
export default connect(mapStateToProps, { createProfile, getCurrentProfile })(
ProfileForm
-);
\ No newline at end of file
+<<<<<<< HEAD
+);
+=======
+);
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
diff --git a/client/src/components/profile/Profile.js b/client/src/components/profile/Profile.js
index 90ab139..e31b0df 100644
--- a/client/src/components/profile/Profile.js
+++ b/client/src/components/profile/Profile.js
@@ -76,11 +76,19 @@ const Profile = ({ getProfileById, profile: { profile }, auth }) => {
);
};
+<<<<<<< HEAD
+
+=======
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
Profile.propTypes = {
getProfileById: PropTypes.func.isRequired,
profile: PropTypes.object.isRequired,
auth: PropTypes.object.isRequired
};
+<<<<<<< HEAD
+
+=======
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
const mapStateToProps = (state) => ({
profile: state.profile,
auth: state.auth
diff --git a/client/src/components/profile/ProfileAbout.js b/client/src/components/profile/ProfileAbout.js
index c317244..0809936 100644
--- a/client/src/components/profile/ProfileAbout.js
+++ b/client/src/components/profile/ProfileAbout.js
@@ -31,4 +31,8 @@ ProfileAbout.propTypes = {
profile: PropTypes.object.isRequired
};
-export default ProfileAbout;
\ No newline at end of file
+<<<<<<< HEAD
+export default ProfileAbout;
+=======
+export default ProfileAbout;
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
diff --git a/client/src/components/profile/ProfileEducation.js b/client/src/components/profile/ProfileEducation.js
index 8d85969..d6fa0d8 100644
--- a/client/src/components/profile/ProfileEducation.js
+++ b/client/src/components/profile/ProfileEducation.js
@@ -26,4 +26,8 @@ ProfileEducation.propTypes = {
education: PropTypes.object.isRequired
};
-export default ProfileEducation;
\ No newline at end of file
+<<<<<<< HEAD
+export default ProfileEducation;
+=======
+export default ProfileEducation;
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
diff --git a/client/src/components/profile/ProfileExperience.js b/client/src/components/profile/ProfileExperience.js
index 767f6d7..245e3c7 100644
--- a/client/src/components/profile/ProfileExperience.js
+++ b/client/src/components/profile/ProfileExperience.js
@@ -26,4 +26,8 @@ ProfileExperience.propTypes = {
experience: PropTypes.object.isRequired
};
-export default ProfileExperience;
\ No newline at end of file
+<<<<<<< HEAD
+export default ProfileExperience;
+=======
+export default ProfileExperience;
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
diff --git a/client/src/components/profile/ProfileGithub.js b/client/src/components/profile/ProfileGithub.js
index 9f563d2..67b374d 100644
--- a/client/src/components/profile/ProfileGithub.js
+++ b/client/src/components/profile/ProfileGithub.js
@@ -48,4 +48,8 @@ const mapStateToProps = state => ({
repos: state.profile.repos
});
-export default connect(mapStateToProps, { getGithubRepos })(ProfileGithub);
\ No newline at end of file
+<<<<<<< HEAD
+export default connect(mapStateToProps, { getGithubRepos })(ProfileGithub);
+=======
+export default connect(mapStateToProps, { getGithubRepos })(ProfileGithub);
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
diff --git a/client/src/components/profile/ProfileTop.js b/client/src/components/profile/ProfileTop.js
index 7712712..a38adc5 100644
--- a/client/src/components/profile/ProfileTop.js
+++ b/client/src/components/profile/ProfileTop.js
@@ -48,4 +48,8 @@ ProfileTop.propTypes = {
profile: PropTypes.object.isRequired
};
-export default ProfileTop;
\ No newline at end of file
+<<<<<<< HEAD
+export default ProfileTop;
+=======
+export default ProfileTop;
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
diff --git a/client/src/components/profiles/ProfileItem.js b/client/src/components/profiles/ProfileItem.js
index 4c69272..2fba35a 100644
--- a/client/src/components/profiles/ProfileItem.js
+++ b/client/src/components/profiles/ProfileItem.js
@@ -39,4 +39,8 @@ ProfileItem.propTypes = {
profile: PropTypes.object.isRequired
};
-export default ProfileItem;
\ No newline at end of file
+<<<<<<< HEAD
+export default ProfileItem;
+=======
+export default ProfileItem;
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
diff --git a/client/src/components/profiles/Profiles.js b/client/src/components/profiles/Profiles.js
index d1bb1d6..b83853a 100644
--- a/client/src/components/profiles/Profiles.js
+++ b/client/src/components/profiles/Profiles.js
@@ -1,3 +1,53 @@
+<<<<<<< HEAD
+import React, { Fragment, useEffect } from 'react';
+import PropTypes from 'prop-types';
+import { connect } from 'react-redux';
+import Spinner from '../layout/Spinner';
+import ProfileItem from './ProfileItem';
+import { getProfiles } from '../../actions/profile';
+
+const Profiles = ({ getProfiles, profile: { profiles, loading } }) => {
+ useEffect(() => {
+ getProfiles();
+ }, [getProfiles]);
+
+ return (
+
+ {loading ? (
+
+ ) : (
+
+ Developers
+
+ Browse and connect with
+ developers
+
+
+ {profiles.length > 0 ? (
+ profiles.map((profile) => (
+
+ ))
+ ) : (
+
No profiles found...
+ )}
+
+
+ )}
+
+ );
+};
+
+Profiles.propTypes = {
+ getProfiles: PropTypes.func.isRequired,
+ profile: PropTypes.object.isRequired
+};
+
+const mapStateToProps = (state) => ({
+ profile: state.profile
+});
+
+export default connect(mapStateToProps, { getProfiles })(Profiles);
+=======
import React from 'react';
import { Link } from 'react-router-dom';
import PropTypes from 'prop-types';
@@ -40,3 +90,4 @@ ProfileItem.propTypes = {
};
export default ProfileItem;
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
diff --git a/client/src/components/routing/PrivateRoute.js b/client/src/components/routing/PrivateRoute.js
index 9d2896b..70a7af5 100644
--- a/client/src/components/routing/PrivateRoute.js
+++ b/client/src/components/routing/PrivateRoute.js
@@ -22,4 +22,8 @@ const mapStateToProps = (state) => ({
auth: state.auth
});
-export default connect(mapStateToProps)(PrivateRoute);
\ No newline at end of file
+<<<<<<< HEAD
+export default connect(mapStateToProps)(PrivateRoute);
+=======
+export default connect(mapStateToProps)(PrivateRoute);
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
diff --git a/client/src/index.js b/client/src/index.js
index b6c6cb2..b763b62 100644
--- a/client/src/index.js
+++ b/client/src/index.js
@@ -1,5 +1,13 @@
+<<<<<<< HEAD
+import React from 'react';
+import ReactDOM from 'react-dom';
+import App from './App';
+
+ReactDOM.render(
, document.getElementById('root'));
+=======
import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App";
const root = ReactDOM.createRoot(document.getElementById('root'));
-root.render(
);
\ No newline at end of file
+root.render(
);
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
diff --git a/client/src/reducers/alert.js b/client/src/reducers/alert.js
index c6a62ef..b66b181 100644
--- a/client/src/reducers/alert.js
+++ b/client/src/reducers/alert.js
@@ -15,4 +15,8 @@ function alertReducer(state = initialState, action) {
}
}
-export default alertReducer;
\ No newline at end of file
+<<<<<<< HEAD
+export default alertReducer;
+=======
+export default alertReducer;
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
diff --git a/client/src/reducers/auth.js b/client/src/reducers/auth.js
index 5998a4e..02537f6 100644
--- a/client/src/reducers/auth.js
+++ b/client/src/reducers/auth.js
@@ -50,4 +50,8 @@ function authReducer(state = initialState, action) {
}
}
-export default authReducer;
\ No newline at end of file
+<<<<<<< HEAD
+export default authReducer;
+=======
+export default authReducer;
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
diff --git a/client/src/reducers/index.js b/client/src/reducers/index.js
index 73ee724..1b20294 100644
--- a/client/src/reducers/index.js
+++ b/client/src/reducers/index.js
@@ -9,4 +9,8 @@ export default combineReducers({
auth,
profile,
post
-});
\ No newline at end of file
+<<<<<<< HEAD
+});
+=======
+});
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
diff --git a/client/src/reducers/post.js b/client/src/reducers/post.js
index 1151ca8..ac280c2 100644
--- a/client/src/reducers/post.js
+++ b/client/src/reducers/post.js
@@ -1,4 +1,88 @@
import {
+<<<<<<< HEAD
+ GET_POSTS,
+ POST_ERROR,
+ UPDATE_LIKES,
+ DELETE_POST,
+ ADD_POST,
+ GET_POST,
+ ADD_COMMENT,
+ REMOVE_COMMENT
+} from '../actions/types';
+
+const initialState = {
+ posts: [],
+ post: null,
+ loading: true,
+ error: {}
+};
+
+function postReducer(state = initialState, action) {
+ const { type, payload } = action;
+
+ switch (type) {
+ case GET_POSTS:
+ return {
+ ...state,
+ posts: payload,
+ loading: false
+ };
+ case GET_POST:
+ return {
+ ...state,
+ post: payload,
+ loading: false
+ };
+ case ADD_POST:
+ return {
+ ...state,
+ posts: [payload, ...state.posts],
+ loading: false
+ };
+ case DELETE_POST:
+ return {
+ ...state,
+ posts: state.posts.filter((post) => post._id !== payload),
+ loading: false
+ };
+ case POST_ERROR:
+ return {
+ ...state,
+ error: payload,
+ loading: false
+ };
+ case UPDATE_LIKES:
+ return {
+ ...state,
+ posts: state.posts.map((post) =>
+ post._id === payload.id ? { ...post, likes: payload.likes } : post
+ ),
+ loading: false
+ };
+ case ADD_COMMENT:
+ return {
+ ...state,
+ post: { ...state.post, comments: payload },
+ loading: false
+ };
+ case REMOVE_COMMENT:
+ return {
+ ...state,
+ post: {
+ ...state.post,
+ comments: state.post.comments.filter(
+ (comment) => comment._id !== payload
+ )
+ },
+ loading: false
+ };
+ default:
+ return state;
+ }
+}
+
+export default postReducer;
+=======
GET_POSTS,
POST_ERROR,
UPDATE_LIKES,
@@ -80,4 +164,5 @@ import {
}
}
- export default postReducer;
\ No newline at end of file
+ export default postReducer;
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
diff --git a/client/src/reducers/profile.js b/client/src/reducers/profile.js
index dad5acb..2968be9 100644
--- a/client/src/reducers/profile.js
+++ b/client/src/reducers/profile.js
@@ -5,15 +5,24 @@ import {
UPDATE_PROFILE,
GET_PROFILES,
GET_REPOS,
+<<<<<<< HEAD
+ NO_REPOS
+} from '../actions/types';
+=======
NO_REPOS,
} from "../actions/types";
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
const initialState = {
profile: null,
profiles: [],
repos: [],
loading: true,
+<<<<<<< HEAD
+ error: {}
+=======
error: {},
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
};
function profileReducer(state = initialState, action) {
@@ -25,37 +34,61 @@ function profileReducer(state = initialState, action) {
return {
...state,
profile: payload,
+<<<<<<< HEAD
+ loading: false
+=======
loading: false,
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
};
case GET_PROFILES:
return {
...state,
profiles: payload,
+<<<<<<< HEAD
+ loading: false
+=======
loading: false,
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
};
case PROFILE_ERROR:
return {
...state,
error: payload,
loading: false,
+<<<<<<< HEAD
+ profile: null
+=======
profile: null,
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
};
case CLEAR_PROFILE:
return {
...state,
profile: null,
+<<<<<<< HEAD
+ repos: []
+=======
repos: [],
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
};
case GET_REPOS:
return {
...state,
repos: payload,
+<<<<<<< HEAD
+ loading: false
+=======
loading: false,
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
};
case NO_REPOS:
return {
...state,
+<<<<<<< HEAD
+ repos: []
+=======
repos: [],
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
};
default:
return state;
diff --git a/client/src/store.js b/client/src/store.js
index 3c4bd1e..f6169e9 100644
--- a/client/src/store.js
+++ b/client/src/store.js
@@ -36,4 +36,8 @@ store.subscribe(() => {
}
});
-export default store;
\ No newline at end of file
+<<<<<<< HEAD
+export default store;
+=======
+export default store;
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
diff --git a/client/src/utils/api.js b/client/src/utils/api.js
index 26399e5..40d2e7e 100644
--- a/client/src/utils/api.js
+++ b/client/src/utils/api.js
@@ -2,12 +2,26 @@ import axios from 'axios';
import store from '../store';
import { LOGOUT } from '../actions/types';
+<<<<<<< HEAD
+// Create an instance of axios
+=======
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
const api = axios.create({
baseURL: '/api',
headers: {
'Content-Type': 'application/json'
}
});
+<<<<<<< HEAD
+/*
+ NOTE: intercept any error responses from the api
+ and check if the token is no longer valid.
+ ie. Token has expired or user is no longer
+ authenticated.
+ logout the user if the token has expired
+*/
+=======
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
api.interceptors.response.use(
(res) => res,
diff --git a/client/src/utils/formatDate.js b/client/src/utils/formatDate.js
index 0e996da..002b464 100644
--- a/client/src/utils/formatDate.js
+++ b/client/src/utils/formatDate.js
@@ -3,4 +3,7 @@ function formatDate(date) {
}
export default formatDate;
+<<<<<<< HEAD
+=======
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
diff --git a/client/src/utils/setAuthToken.js b/client/src/utils/setAuthToken.js
index 16bce85..592152f 100644
--- a/client/src/utils/setAuthToken.js
+++ b/client/src/utils/setAuthToken.js
@@ -1,3 +1,16 @@
+<<<<<<< HEAD
+import api from './api';
+
+// store our JWT in LS and set axios headers if we do have a token
+
+const setAuthToken = (token) => {
+ if (token) {
+ api.defaults.headers.common['x-auth-token'] = token;
+ localStorage.setItem('token', token);
+ } else {
+ delete api.defaults.headers.common['x-auth-token'];
+ localStorage.removeItem('token');
+=======
import axios from "axios";
const setAuthToken = (token) => {
@@ -7,6 +20,7 @@ const setAuthToken = (token) => {
} else {
delete axios.defaults.common["x-auth-token"];
localStorage.removeItem('token')
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
}
};
diff --git a/package.json b/package.json
index 3dbeeb9..dfaf8d9 100644
--- a/package.json
+++ b/package.json
@@ -7,8 +7,12 @@
"start": "node server",
"server": "nodemon server",
"client": "npm start --prefix client --trace-depracation",
+<<<<<<< HEAD
+ "dev": "concurrently \"npm run server\" \"npm run client\""
+=======
"dev": "concurrently \"npm run server\" \"npm run client\"",
"heroku-postbuild":"NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
},
"author": "",
"license": "ISC",
diff --git a/server.js b/server.js
index 0a1793a..74ff1fa 100644
--- a/server.js
+++ b/server.js
@@ -1,16 +1,25 @@
const express = require('express');
const connectDB= require('./config/db')
+<<<<<<< HEAD
+=======
const path = require('path')
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
const app = express();
connectDB();
app.use(express.json({extended:false}));
+<<<<<<< HEAD
+app.get('/',(req,res)=> res.send('API Running'));
+=======
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
app.use('/api/users', require('./routers/api/users'))
app.use('/api/auth', require('./routers/api/auth'))
app.use('/api/profile', require('./routers/api/profile'))
app.use('/api/posts', require('./routers/api/posts'))
+<<<<<<< HEAD
+=======
// Serve static assets in production
if (process.env.NODE_ENV==='production'){
app.use(express.static('client/build'));
@@ -18,6 +27,7 @@ if (process.env.NODE_ENV==='production'){
res.sendFile(path.resolve(__dirname, 'client', 'build','index.html'))
])
}
+>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
const PORT = process.env.PORT || 5000;
app.listen(PORT,()=> console.log(`Server started on port ${PORT}`));
\ No newline at end of file