Fixing after react update
This commit is contained in:
+9
-1
@@ -333,7 +333,11 @@ button {
|
||||
/* Landing Page */
|
||||
.landing {
|
||||
position: relative;
|
||||
<<<<<<< HEAD
|
||||
background: url('./img/showcase.jpg') no-repeat center center/cover;
|
||||
=======
|
||||
background: url('./img/vimCheatSheet.jpg') no-repeat center center/cover;
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
@@ -581,4 +585,8 @@ button {
|
||||
top: 4rem;
|
||||
right: 2rem;
|
||||
display: inline-block;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
=======
|
||||
}
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -1,3 +1,31 @@
|
||||
<<<<<<< HEAD
|
||||
import React, { useEffect } from 'react';
|
||||
import { BrowserRouter as Router, Route, Routes } from 'react-router-dom';
|
||||
import Navbar from './components/layout/Navbar';
|
||||
import Landing from './components/layout/Landing';
|
||||
import Register from './components/auth/Register';
|
||||
import Login from './components/auth/Login';
|
||||
import Alert from './components/layout/Alert';
|
||||
import Dashboard from './components/dashboard/Dashboard';
|
||||
import ProfileForm from './components/profile-forms/ProfileForm';
|
||||
import AddExperience from './components/profile-forms/AddExperience';
|
||||
import AddEducation from './components/profile-forms/AddEducation';
|
||||
import Profiles from './components/profiles/Profiles';
|
||||
import Profile from './components/profile/Profile';
|
||||
import Posts from './components/posts/Posts';
|
||||
import Post from './components/post/Post';
|
||||
import NotFound from './components/layout/NotFound';
|
||||
import PrivateRoute from './components/routing/PrivateRoute';
|
||||
import { LOGOUT } from './actions/types';
|
||||
|
||||
// Redux
|
||||
import { Provider } from 'react-redux';
|
||||
import store from './store';
|
||||
import { loadUser } from './actions/auth';
|
||||
import setAuthToken from './utils/setAuthToken';
|
||||
|
||||
import './App.css';
|
||||
=======
|
||||
import React, { useEffect } from "react";
|
||||
import { BrowserRouter as Router, Route, Routes } from "react-router-dom";
|
||||
import Navbar from "./components/layout/Navbar";
|
||||
@@ -24,6 +52,7 @@ import { loadUser } from "./actions/auth";
|
||||
import setAuthToken from "./utils/setAuthToken";
|
||||
|
||||
import "./App.css";
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
const App = () => {
|
||||
useEffect(() => {
|
||||
@@ -37,7 +66,11 @@ const App = () => {
|
||||
store.dispatch(loadUser());
|
||||
|
||||
// log user out from all tabs if they log out in one tab
|
||||
<<<<<<< HEAD
|
||||
window.addEventListener('storage', () => {
|
||||
=======
|
||||
window.addEventListener("storage", () => {
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
if (!localStorage.token) store.dispatch({ type: LOGOUT });
|
||||
});
|
||||
}, []);
|
||||
@@ -52,7 +85,11 @@ const App = () => {
|
||||
<Route path="register" element={<Register />} />
|
||||
<Route path="login" element={<Login />} />
|
||||
<Route path="profiles" element={<Profiles />} />
|
||||
<<<<<<< HEAD
|
||||
<Route path="profile/:id" element={<Profile />} />
|
||||
=======
|
||||
<Route path="porifles/:id" element={<Profile />} />
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
<Route
|
||||
path="dashboard"
|
||||
element={<PrivateRoute component={Dashboard} />}
|
||||
|
||||
@@ -9,4 +9,8 @@ export const setAlert = (msg, alertType, timeout = 5000) => dispatch => {
|
||||
});
|
||||
|
||||
setTimeout(() => dispatch({ type: REMOVE_ALERT, payload: id }), timeout);
|
||||
};
|
||||
<<<<<<< HEAD
|
||||
};
|
||||
=======
|
||||
};
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -63,6 +63,10 @@ export const login = (email, password) => async (dispatch) => {
|
||||
try {
|
||||
const res = await api.post("/auth", body);
|
||||
|
||||
<<<<<<< HEAD
|
||||
console.log(res)
|
||||
=======
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
dispatch({
|
||||
type: LOGIN_SUCCESS,
|
||||
payload: res.data,
|
||||
|
||||
Vendored
BIN
Binary file not shown.
@@ -1,9 +1,16 @@
|
||||
import React, { useState } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
<<<<<<< HEAD
|
||||
import { Link, Navigate } from 'react-router-dom';
|
||||
import { setAlert } from '../../actions/alert';
|
||||
import { register } from '../../actions/auth';
|
||||
import PropTypes from 'prop-types';
|
||||
=======
|
||||
import PropTypes from 'prop-types';
|
||||
import { Link, Navigate } from 'react-router-dom';
|
||||
import { setAlert } from '../../actions/alert';
|
||||
import { register } from '../../actions/auth';
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
const Register = ({ setAlert, register, isAuthenticated }) => {
|
||||
const [formData, setFormData] = useState({
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
<<<<<<< HEAD
|
||||
import React, { useEffect } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
import DashboardActions from './DashboardActions';
|
||||
import Experience from './Experience';
|
||||
import Education from './Education';
|
||||
import { getCurrentProfile, deleteAccount } from '../../actions/profile';
|
||||
=======
|
||||
import React, { useEffect } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import PropTypes from "prop-types";
|
||||
@@ -6,12 +16,17 @@ import DashboardActions from "./DashboardActions";
|
||||
import Experience from "./Experience";
|
||||
import Education from "./Education";
|
||||
import { getCurrentProfile, deleteAccount } from "../../actions/profile";
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
const Dashboard = ({
|
||||
getCurrentProfile,
|
||||
deleteAccount,
|
||||
auth: { user },
|
||||
<<<<<<< HEAD
|
||||
profile: { profile }
|
||||
=======
|
||||
profile: { profile },
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
}) => {
|
||||
useEffect(() => {
|
||||
getCurrentProfile();
|
||||
@@ -51,12 +66,20 @@ Dashboard.propTypes = {
|
||||
getCurrentProfile: PropTypes.func.isRequired,
|
||||
deleteAccount: PropTypes.func.isRequired,
|
||||
auth: PropTypes.object.isRequired,
|
||||
<<<<<<< HEAD
|
||||
profile: PropTypes.object.isRequired
|
||||
=======
|
||||
profile: PropTypes.object.isRequired,
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => ({
|
||||
auth: state.auth,
|
||||
<<<<<<< HEAD
|
||||
profile: state.profile
|
||||
=======
|
||||
profile: state.profile,
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, { getCurrentProfile, deleteAccount })(
|
||||
|
||||
@@ -17,4 +17,8 @@ const DashboardActions = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default DashboardActions;
|
||||
<<<<<<< HEAD
|
||||
export default DashboardActions;
|
||||
=======
|
||||
export default DashboardActions;
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -46,4 +46,8 @@ Education.propTypes = {
|
||||
deleteEducation: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export default connect(null, { deleteEducation })(Education);
|
||||
<<<<<<< HEAD
|
||||
export default connect(null, { deleteEducation })(Education);
|
||||
=======
|
||||
export default connect(null, { deleteEducation })(Education);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
import React, { Fragment } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
@@ -47,4 +50,8 @@ Experience.propTypes = {
|
||||
deleteExperience: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export default connect(null, { deleteExperience })(Experience);
|
||||
<<<<<<< HEAD
|
||||
export default connect(null, { deleteExperience })(Experience);
|
||||
=======
|
||||
export default connect(null, { deleteExperience })(Experience);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -20,4 +20,8 @@ const mapStateToProps = (state) => ({
|
||||
alerts: state.alert
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps)(Alert);
|
||||
<<<<<<< HEAD
|
||||
export default connect(mapStateToProps)(Alert);
|
||||
=======
|
||||
export default connect(mapStateToProps)(Alert);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -5,6 +5,25 @@ import PropTypes from 'prop-types';
|
||||
|
||||
const Landing = ({ isAuthenticated }) => {
|
||||
if (isAuthenticated) {
|
||||
<<<<<<< HEAD
|
||||
return <Navigate to="/dashboard" />;
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="landing">
|
||||
<div className="dark-overlay">
|
||||
<div className="landing-inner">
|
||||
<h1 className="x-large">Developer Connector</h1>
|
||||
<p className="lead">
|
||||
Create a developer profile/portfolio, share posts and get help from
|
||||
other developers
|
||||
</p>
|
||||
<div className="buttons">
|
||||
<Link to="/register" className="btn btn-primary">
|
||||
Sign Up
|
||||
</Link>
|
||||
<Link to="/login" className="btn btn-light">
|
||||
=======
|
||||
return <Navigate to='/dashboard' />;
|
||||
}
|
||||
|
||||
@@ -22,6 +41,7 @@ const Landing = ({ isAuthenticated }) => {
|
||||
Sign Up
|
||||
</Link>
|
||||
<Link to='/login' className='btn btn-light'>
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
Login
|
||||
</Link>
|
||||
</div>
|
||||
@@ -35,8 +55,16 @@ Landing.propTypes = {
|
||||
isAuthenticated: PropTypes.bool
|
||||
};
|
||||
|
||||
<<<<<<< HEAD
|
||||
const mapStateToProps = (state) => ({
|
||||
isAuthenticated: state.auth.isAuthenticated
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps)(Landing);
|
||||
=======
|
||||
const mapStateToProps = state => ({
|
||||
isAuthenticated: state.auth.isAuthenticated
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps)(Landing);
|
||||
export default connect(mapStateToProps)(Landing);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -11,4 +11,8 @@ const NotFound = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default NotFound;
|
||||
<<<<<<< HEAD
|
||||
export default NotFound;
|
||||
=======
|
||||
export default NotFound;
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -11,4 +11,8 @@ const Spinner = () => (
|
||||
</Fragment>
|
||||
);
|
||||
|
||||
export default Spinner;
|
||||
<<<<<<< HEAD
|
||||
export default Spinner;
|
||||
=======
|
||||
export default Spinner;
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -41,4 +41,8 @@ CommentForm.propTypes = {
|
||||
export default connect(
|
||||
null,
|
||||
{ addComment }
|
||||
)(CommentForm);
|
||||
<<<<<<< HEAD
|
||||
)(CommentForm);
|
||||
=======
|
||||
)(CommentForm);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -45,4 +45,8 @@ const mapStateToProps = (state) => ({
|
||||
auth: state.auth
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, { deleteComment })(CommentItem);
|
||||
<<<<<<< HEAD
|
||||
export default connect(mapStateToProps, { deleteComment })(CommentItem);
|
||||
=======
|
||||
export default connect(mapStateToProps, { deleteComment })(CommentItem);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -41,4 +41,8 @@ const mapStateToProps = (state) => ({
|
||||
post: state.post
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, { getPost })(Post);
|
||||
<<<<<<< HEAD
|
||||
export default connect(mapStateToProps, { getPost })(Post);
|
||||
=======
|
||||
export default connect(mapStateToProps, { getPost })(Post);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -41,4 +41,8 @@ PostForm.propTypes = {
|
||||
export default connect(
|
||||
null,
|
||||
{ addPost }
|
||||
)(PostForm);
|
||||
<<<<<<< HEAD
|
||||
)(PostForm);
|
||||
=======
|
||||
)(PostForm);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
<<<<<<< HEAD
|
||||
import React from 'react';
|
||||
=======
|
||||
import React, { Fragment } from 'react';
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
import PropTypes from 'prop-types';
|
||||
import { Link } from 'react-router-dom';
|
||||
import formatDate from '../../utils/formatDate';
|
||||
@@ -10,8 +14,12 @@ const PostItem = ({
|
||||
removeLike,
|
||||
deletePost,
|
||||
auth,
|
||||
<<<<<<< HEAD
|
||||
post: { _id, text, name, avatar, user, likes, comments, date }
|
||||
=======
|
||||
post: { _id, text, name, avatar, user, likes, comments, date },
|
||||
showActions
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
}) => (
|
||||
<div className="post bg-white p-1 my-1">
|
||||
<div>
|
||||
@@ -24,6 +32,37 @@ const PostItem = ({
|
||||
<p className="my-1">{text}</p>
|
||||
<p className="post-date">Posted on {formatDate(date)}</p>
|
||||
|
||||
<<<<<<< HEAD
|
||||
<button
|
||||
onClick={() => addLike(_id)}
|
||||
type="button"
|
||||
className="btn btn-light"
|
||||
>
|
||||
<i className="fas fa-thumbs-up" />{' '}
|
||||
<span>{likes.length > 0 && <span>{likes.length}</span>}</span>
|
||||
</button>
|
||||
<button
|
||||
onClick={() => removeLike(_id)}
|
||||
type="button"
|
||||
className="btn btn-light"
|
||||
>
|
||||
<i className="fas fa-thumbs-down" />
|
||||
</button>
|
||||
<Link to={`/posts/${_id}`} className="btn btn-primary">
|
||||
Discussion{' '}
|
||||
{comments.length > 0 && (
|
||||
<span className="comment-count">{comments.length}</span>
|
||||
)}
|
||||
</Link>
|
||||
{!auth.loading && user === auth.user._id && (
|
||||
<button
|
||||
onClick={() => deletePost(_id)}
|
||||
type="button"
|
||||
className="btn btn-danger"
|
||||
>
|
||||
<i className="fas fa-times" />
|
||||
</button>
|
||||
=======
|
||||
{showActions && (
|
||||
<Fragment>
|
||||
<button
|
||||
@@ -57,22 +96,30 @@ const PostItem = ({
|
||||
</button>
|
||||
)}
|
||||
</Fragment>
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
PostItem.defaultProps = {
|
||||
showActions: true
|
||||
};
|
||||
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
PostItem.propTypes = {
|
||||
post: PropTypes.object.isRequired,
|
||||
auth: PropTypes.object.isRequired,
|
||||
addLike: PropTypes.func.isRequired,
|
||||
removeLike: PropTypes.func.isRequired,
|
||||
<<<<<<< HEAD
|
||||
deletePost: PropTypes.func.isRequired
|
||||
=======
|
||||
deletePost: PropTypes.func.isRequired,
|
||||
showActions: PropTypes.bool
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => ({
|
||||
@@ -81,4 +128,8 @@ const mapStateToProps = (state) => ({
|
||||
|
||||
export default connect(mapStateToProps, { addLike, removeLike, deletePost })(
|
||||
PostItem
|
||||
);
|
||||
<<<<<<< HEAD
|
||||
);
|
||||
=======
|
||||
);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -35,4 +35,8 @@ const mapStateToProps = (state) => ({
|
||||
post: state.post
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, { getPosts })(Posts);
|
||||
<<<<<<< HEAD
|
||||
export default connect(mapStateToProps, { getPosts })(Posts);
|
||||
=======
|
||||
export default connect(mapStateToProps, { getPosts })(Posts);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -34,7 +34,11 @@ const AddEducation = ({ addEducation }) => {
|
||||
className="form"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
<<<<<<< HEAD
|
||||
addEducation(formData).then(() => navigate('/dashboard'));
|
||||
=======
|
||||
addEducation(formData, navigate);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
}}
|
||||
>
|
||||
<div className="form-group">
|
||||
@@ -115,4 +119,8 @@ AddEducation.propTypes = {
|
||||
addEducation: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export default connect(null, { addEducation })(AddEducation);
|
||||
<<<<<<< HEAD
|
||||
export default connect(null, { addEducation })(AddEducation);
|
||||
=======
|
||||
export default connect(null, { addEducation })(AddEducation);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -33,7 +33,11 @@ const AddExperience = ({ addExperience }) => {
|
||||
className="form"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
<<<<<<< HEAD
|
||||
addExperience(formData).then(() => navigate('/dashboard'));
|
||||
=======
|
||||
addExperience(formData, navigate);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
}}
|
||||
>
|
||||
<div className="form-group">
|
||||
@@ -116,4 +120,8 @@ AddExperience.propTypes = {
|
||||
addExperience: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export default connect(null, { addExperience })(AddExperience);
|
||||
<<<<<<< HEAD
|
||||
export default connect(null, { addExperience })(AddExperience);
|
||||
=======
|
||||
export default connect(null, { addExperience })(AddExperience);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -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
|
||||
);
|
||||
<<<<<<< HEAD
|
||||
);
|
||||
=======
|
||||
);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -76,11 +76,19 @@ const Profile = ({ getProfileById, profile: { profile }, auth }) => {
|
||||
</section>
|
||||
);
|
||||
};
|
||||
<<<<<<< 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
|
||||
|
||||
@@ -31,4 +31,8 @@ ProfileAbout.propTypes = {
|
||||
profile: PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
export default ProfileAbout;
|
||||
<<<<<<< HEAD
|
||||
export default ProfileAbout;
|
||||
=======
|
||||
export default ProfileAbout;
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -26,4 +26,8 @@ ProfileEducation.propTypes = {
|
||||
education: PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
export default ProfileEducation;
|
||||
<<<<<<< HEAD
|
||||
export default ProfileEducation;
|
||||
=======
|
||||
export default ProfileEducation;
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -26,4 +26,8 @@ ProfileExperience.propTypes = {
|
||||
experience: PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
export default ProfileExperience;
|
||||
<<<<<<< HEAD
|
||||
export default ProfileExperience;
|
||||
=======
|
||||
export default ProfileExperience;
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -48,4 +48,8 @@ const mapStateToProps = state => ({
|
||||
repos: state.profile.repos
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, { getGithubRepos })(ProfileGithub);
|
||||
<<<<<<< HEAD
|
||||
export default connect(mapStateToProps, { getGithubRepos })(ProfileGithub);
|
||||
=======
|
||||
export default connect(mapStateToProps, { getGithubRepos })(ProfileGithub);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -48,4 +48,8 @@ ProfileTop.propTypes = {
|
||||
profile: PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
export default ProfileTop;
|
||||
<<<<<<< HEAD
|
||||
export default ProfileTop;
|
||||
=======
|
||||
export default ProfileTop;
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -39,4 +39,8 @@ ProfileItem.propTypes = {
|
||||
profile: PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
export default ProfileItem;
|
||||
<<<<<<< HEAD
|
||||
export default ProfileItem;
|
||||
=======
|
||||
export default ProfileItem;
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -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 (
|
||||
<section className="container">
|
||||
{loading ? (
|
||||
<Spinner />
|
||||
) : (
|
||||
<Fragment>
|
||||
<h1 className="large text-primary">Developers</h1>
|
||||
<p className="lead">
|
||||
<i className="fab fa-connectdevelop" /> Browse and connect with
|
||||
developers
|
||||
</p>
|
||||
<div className="profiles">
|
||||
{profiles.length > 0 ? (
|
||||
profiles.map((profile) => (
|
||||
<ProfileItem key={profile._id} profile={profile} />
|
||||
))
|
||||
) : (
|
||||
<h4>No profiles found...</h4>
|
||||
)}
|
||||
</div>
|
||||
</Fragment>
|
||||
)}
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
||||
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
|
||||
|
||||
@@ -22,4 +22,8 @@ const mapStateToProps = (state) => ({
|
||||
auth: state.auth
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps)(PrivateRoute);
|
||||
<<<<<<< HEAD
|
||||
export default connect(mapStateToProps)(PrivateRoute);
|
||||
=======
|
||||
export default connect(mapStateToProps)(PrivateRoute);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
+9
-1
@@ -1,5 +1,13 @@
|
||||
<<<<<<< HEAD
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import App from './App';
|
||||
|
||||
ReactDOM.render(<App />, 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(<App />);
|
||||
root.render(<App />);
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -15,4 +15,8 @@ function alertReducer(state = initialState, action) {
|
||||
}
|
||||
}
|
||||
|
||||
export default alertReducer;
|
||||
<<<<<<< HEAD
|
||||
export default alertReducer;
|
||||
=======
|
||||
export default alertReducer;
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -50,4 +50,8 @@ function authReducer(state = initialState, action) {
|
||||
}
|
||||
}
|
||||
|
||||
export default authReducer;
|
||||
<<<<<<< HEAD
|
||||
export default authReducer;
|
||||
=======
|
||||
export default authReducer;
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -9,4 +9,8 @@ export default combineReducers({
|
||||
auth,
|
||||
profile,
|
||||
post
|
||||
});
|
||||
<<<<<<< HEAD
|
||||
});
|
||||
=======
|
||||
});
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -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;
|
||||
export default postReducer;
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -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;
|
||||
|
||||
+5
-1
@@ -36,4 +36,8 @@ store.subscribe(() => {
|
||||
}
|
||||
});
|
||||
|
||||
export default store;
|
||||
<<<<<<< HEAD
|
||||
export default store;
|
||||
=======
|
||||
export default store;
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -3,4 +3,7 @@ function formatDate(date) {
|
||||
}
|
||||
|
||||
export default formatDate;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||
|
||||
@@ -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
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user