Fixing after react update
This commit is contained in:
@@ -20,7 +20,11 @@
|
|||||||
"web-vitals": "^2.1.4"
|
"web-vitals": "^2.1.4"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
<<<<<<< HEAD
|
||||||
|
"start": "react-scripts start --openssl-legacy-provider start",
|
||||||
|
=======
|
||||||
"start": "react-scripts start",
|
"start": "react-scripts start",
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
"build": "react-scripts build",
|
"build": "react-scripts build",
|
||||||
"test": "react-scripts test",
|
"test": "react-scripts test",
|
||||||
"eject": "react-scripts eject"
|
"eject": "react-scripts eject"
|
||||||
@@ -43,5 +47,9 @@
|
|||||||
"last 1 safari version"
|
"last 1 safari version"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
<<<<<<< HEAD
|
||||||
|
"proxy":"http://localhost:5000"
|
||||||
|
=======
|
||||||
"proxy":"http://localhost:5000/"
|
"proxy":"http://localhost:5000/"
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -333,7 +333,11 @@ button {
|
|||||||
/* Landing Page */
|
/* Landing Page */
|
||||||
.landing {
|
.landing {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
<<<<<<< HEAD
|
||||||
|
background: url('./img/showcase.jpg') no-repeat center center/cover;
|
||||||
|
=======
|
||||||
background: url('./img/vimCheatSheet.jpg') no-repeat center center/cover;
|
background: url('./img/vimCheatSheet.jpg') no-repeat center center/cover;
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -581,4 +585,8 @@ button {
|
|||||||
top: 4rem;
|
top: 4rem;
|
||||||
right: 2rem;
|
right: 2rem;
|
||||||
display: inline-block;
|
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 React, { useEffect } from "react";
|
||||||
import { BrowserRouter as Router, Route, Routes } from "react-router-dom";
|
import { BrowserRouter as Router, Route, Routes } from "react-router-dom";
|
||||||
import Navbar from "./components/layout/Navbar";
|
import Navbar from "./components/layout/Navbar";
|
||||||
@@ -24,6 +52,7 @@ import { loadUser } from "./actions/auth";
|
|||||||
import setAuthToken from "./utils/setAuthToken";
|
import setAuthToken from "./utils/setAuthToken";
|
||||||
|
|
||||||
import "./App.css";
|
import "./App.css";
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
|
|
||||||
const App = () => {
|
const App = () => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -37,7 +66,11 @@ const App = () => {
|
|||||||
store.dispatch(loadUser());
|
store.dispatch(loadUser());
|
||||||
|
|
||||||
// log user out from all tabs if they log out in one tab
|
// log user out from all tabs if they log out in one tab
|
||||||
|
<<<<<<< HEAD
|
||||||
|
window.addEventListener('storage', () => {
|
||||||
|
=======
|
||||||
window.addEventListener("storage", () => {
|
window.addEventListener("storage", () => {
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
if (!localStorage.token) store.dispatch({ type: LOGOUT });
|
if (!localStorage.token) store.dispatch({ type: LOGOUT });
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
@@ -52,7 +85,11 @@ const App = () => {
|
|||||||
<Route path="register" element={<Register />} />
|
<Route path="register" element={<Register />} />
|
||||||
<Route path="login" element={<Login />} />
|
<Route path="login" element={<Login />} />
|
||||||
<Route path="profiles" element={<Profiles />} />
|
<Route path="profiles" element={<Profiles />} />
|
||||||
|
<<<<<<< HEAD
|
||||||
|
<Route path="profile/:id" element={<Profile />} />
|
||||||
|
=======
|
||||||
<Route path="porifles/:id" element={<Profile />} />
|
<Route path="porifles/:id" element={<Profile />} />
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
<Route
|
<Route
|
||||||
path="dashboard"
|
path="dashboard"
|
||||||
element={<PrivateRoute component={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);
|
setTimeout(() => dispatch({ type: REMOVE_ALERT, payload: id }), timeout);
|
||||||
|
<<<<<<< HEAD
|
||||||
};
|
};
|
||||||
|
=======
|
||||||
|
};
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
|
|||||||
@@ -63,6 +63,10 @@ export const login = (email, password) => async (dispatch) => {
|
|||||||
try {
|
try {
|
||||||
const res = await api.post("/auth", body);
|
const res = await api.post("/auth", body);
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
console.log(res)
|
||||||
|
=======
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
dispatch({
|
dispatch({
|
||||||
type: LOGIN_SUCCESS,
|
type: LOGIN_SUCCESS,
|
||||||
payload: res.data,
|
payload: res.data,
|
||||||
|
|||||||
Vendored
BIN
Binary file not shown.
@@ -1,9 +1,16 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { connect } from 'react-redux';
|
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 PropTypes from 'prop-types';
|
||||||
import { Link, Navigate } from 'react-router-dom';
|
import { Link, Navigate } from 'react-router-dom';
|
||||||
import { setAlert } from '../../actions/alert';
|
import { setAlert } from '../../actions/alert';
|
||||||
import { register } from '../../actions/auth';
|
import { register } from '../../actions/auth';
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
|
|
||||||
const Register = ({ setAlert, register, isAuthenticated }) => {
|
const Register = ({ setAlert, register, isAuthenticated }) => {
|
||||||
const [formData, setFormData] = useState({
|
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 React, { useEffect } from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
@@ -6,12 +16,17 @@ import DashboardActions from "./DashboardActions";
|
|||||||
import Experience from "./Experience";
|
import Experience from "./Experience";
|
||||||
import Education from "./Education";
|
import Education from "./Education";
|
||||||
import { getCurrentProfile, deleteAccount } from "../../actions/profile";
|
import { getCurrentProfile, deleteAccount } from "../../actions/profile";
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
|
|
||||||
const Dashboard = ({
|
const Dashboard = ({
|
||||||
getCurrentProfile,
|
getCurrentProfile,
|
||||||
deleteAccount,
|
deleteAccount,
|
||||||
auth: { user },
|
auth: { user },
|
||||||
|
<<<<<<< HEAD
|
||||||
|
profile: { profile }
|
||||||
|
=======
|
||||||
profile: { profile },
|
profile: { profile },
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
}) => {
|
}) => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getCurrentProfile();
|
getCurrentProfile();
|
||||||
@@ -51,12 +66,20 @@ Dashboard.propTypes = {
|
|||||||
getCurrentProfile: PropTypes.func.isRequired,
|
getCurrentProfile: PropTypes.func.isRequired,
|
||||||
deleteAccount: PropTypes.func.isRequired,
|
deleteAccount: PropTypes.func.isRequired,
|
||||||
auth: PropTypes.object.isRequired,
|
auth: PropTypes.object.isRequired,
|
||||||
|
<<<<<<< HEAD
|
||||||
|
profile: PropTypes.object.isRequired
|
||||||
|
=======
|
||||||
profile: PropTypes.object.isRequired,
|
profile: PropTypes.object.isRequired,
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapStateToProps = (state) => ({
|
const mapStateToProps = (state) => ({
|
||||||
auth: state.auth,
|
auth: state.auth,
|
||||||
|
<<<<<<< HEAD
|
||||||
|
profile: state.profile
|
||||||
|
=======
|
||||||
profile: state.profile,
|
profile: state.profile,
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(mapStateToProps, { getCurrentProfile, deleteAccount })(
|
export default connect(mapStateToProps, { getCurrentProfile, deleteAccount })(
|
||||||
|
|||||||
@@ -17,4 +17,8 @@ const DashboardActions = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
export default DashboardActions;
|
export default DashboardActions;
|
||||||
|
=======
|
||||||
|
export default DashboardActions;
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
|
|||||||
@@ -46,4 +46,8 @@ Education.propTypes = {
|
|||||||
deleteEducation: PropTypes.func.isRequired
|
deleteEducation: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
export default connect(null, { deleteEducation })(Education);
|
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 React, { Fragment } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
@@ -47,4 +50,8 @@ Experience.propTypes = {
|
|||||||
deleteExperience: PropTypes.func.isRequired
|
deleteExperience: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
export default connect(null, { deleteExperience })(Experience);
|
export default connect(null, { deleteExperience })(Experience);
|
||||||
|
=======
|
||||||
|
export default connect(null, { deleteExperience })(Experience);
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
|
|||||||
@@ -20,4 +20,8 @@ const mapStateToProps = (state) => ({
|
|||||||
alerts: state.alert
|
alerts: state.alert
|
||||||
});
|
});
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
export default connect(mapStateToProps)(Alert);
|
export default connect(mapStateToProps)(Alert);
|
||||||
|
=======
|
||||||
|
export default connect(mapStateToProps)(Alert);
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
|
|||||||
@@ -5,6 +5,25 @@ import PropTypes from 'prop-types';
|
|||||||
|
|
||||||
const Landing = ({ isAuthenticated }) => {
|
const Landing = ({ isAuthenticated }) => {
|
||||||
if (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' />;
|
return <Navigate to='/dashboard' />;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,6 +41,7 @@ const Landing = ({ isAuthenticated }) => {
|
|||||||
Sign Up
|
Sign Up
|
||||||
</Link>
|
</Link>
|
||||||
<Link to='/login' className='btn btn-light'>
|
<Link to='/login' className='btn btn-light'>
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
Login
|
Login
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
@@ -35,8 +55,16 @@ Landing.propTypes = {
|
|||||||
isAuthenticated: PropTypes.bool
|
isAuthenticated: PropTypes.bool
|
||||||
};
|
};
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
const mapStateToProps = (state) => ({
|
||||||
|
isAuthenticated: state.auth.isAuthenticated
|
||||||
|
});
|
||||||
|
|
||||||
|
export default connect(mapStateToProps)(Landing);
|
||||||
|
=======
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
isAuthenticated: state.auth.isAuthenticated
|
isAuthenticated: state.auth.isAuthenticated
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(mapStateToProps)(Landing);
|
export default connect(mapStateToProps)(Landing);
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
|
|||||||
@@ -11,4 +11,8 @@ const NotFound = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
export default NotFound;
|
export default NotFound;
|
||||||
|
=======
|
||||||
|
export default NotFound;
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
|
|||||||
@@ -11,4 +11,8 @@ const Spinner = () => (
|
|||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
export default Spinner;
|
export default Spinner;
|
||||||
|
=======
|
||||||
|
export default Spinner;
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
|
|||||||
@@ -41,4 +41,8 @@ CommentForm.propTypes = {
|
|||||||
export default connect(
|
export default connect(
|
||||||
null,
|
null,
|
||||||
{ addComment }
|
{ addComment }
|
||||||
|
<<<<<<< HEAD
|
||||||
)(CommentForm);
|
)(CommentForm);
|
||||||
|
=======
|
||||||
|
)(CommentForm);
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
|
|||||||
@@ -45,4 +45,8 @@ const mapStateToProps = (state) => ({
|
|||||||
auth: state.auth
|
auth: state.auth
|
||||||
});
|
});
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
export default connect(mapStateToProps, { deleteComment })(CommentItem);
|
export default connect(mapStateToProps, { deleteComment })(CommentItem);
|
||||||
|
=======
|
||||||
|
export default connect(mapStateToProps, { deleteComment })(CommentItem);
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
|
|||||||
@@ -41,4 +41,8 @@ const mapStateToProps = (state) => ({
|
|||||||
post: state.post
|
post: state.post
|
||||||
});
|
});
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
export default connect(mapStateToProps, { getPost })(Post);
|
export default connect(mapStateToProps, { getPost })(Post);
|
||||||
|
=======
|
||||||
|
export default connect(mapStateToProps, { getPost })(Post);
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
|
|||||||
@@ -41,4 +41,8 @@ PostForm.propTypes = {
|
|||||||
export default connect(
|
export default connect(
|
||||||
null,
|
null,
|
||||||
{ addPost }
|
{ addPost }
|
||||||
|
<<<<<<< HEAD
|
||||||
)(PostForm);
|
)(PostForm);
|
||||||
|
=======
|
||||||
|
)(PostForm);
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
|
<<<<<<< HEAD
|
||||||
|
import React from 'react';
|
||||||
|
=======
|
||||||
import React, { Fragment } from 'react';
|
import React, { Fragment } from 'react';
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import formatDate from '../../utils/formatDate';
|
import formatDate from '../../utils/formatDate';
|
||||||
@@ -10,8 +14,12 @@ const PostItem = ({
|
|||||||
removeLike,
|
removeLike,
|
||||||
deletePost,
|
deletePost,
|
||||||
auth,
|
auth,
|
||||||
|
<<<<<<< HEAD
|
||||||
|
post: { _id, text, name, avatar, user, likes, comments, date }
|
||||||
|
=======
|
||||||
post: { _id, text, name, avatar, user, likes, comments, date },
|
post: { _id, text, name, avatar, user, likes, comments, date },
|
||||||
showActions
|
showActions
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
}) => (
|
}) => (
|
||||||
<div className="post bg-white p-1 my-1">
|
<div className="post bg-white p-1 my-1">
|
||||||
<div>
|
<div>
|
||||||
@@ -24,6 +32,37 @@ const PostItem = ({
|
|||||||
<p className="my-1">{text}</p>
|
<p className="my-1">{text}</p>
|
||||||
<p className="post-date">Posted on {formatDate(date)}</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 && (
|
{showActions && (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<button
|
<button
|
||||||
@@ -57,22 +96,30 @@ const PostItem = ({
|
|||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
</Fragment>
|
</Fragment>
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
PostItem.defaultProps = {
|
PostItem.defaultProps = {
|
||||||
showActions: true
|
showActions: true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
PostItem.propTypes = {
|
PostItem.propTypes = {
|
||||||
post: PropTypes.object.isRequired,
|
post: PropTypes.object.isRequired,
|
||||||
auth: PropTypes.object.isRequired,
|
auth: PropTypes.object.isRequired,
|
||||||
addLike: PropTypes.func.isRequired,
|
addLike: PropTypes.func.isRequired,
|
||||||
removeLike: PropTypes.func.isRequired,
|
removeLike: PropTypes.func.isRequired,
|
||||||
|
<<<<<<< HEAD
|
||||||
|
deletePost: PropTypes.func.isRequired
|
||||||
|
=======
|
||||||
deletePost: PropTypes.func.isRequired,
|
deletePost: PropTypes.func.isRequired,
|
||||||
showActions: PropTypes.bool
|
showActions: PropTypes.bool
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapStateToProps = (state) => ({
|
const mapStateToProps = (state) => ({
|
||||||
@@ -81,4 +128,8 @@ const mapStateToProps = (state) => ({
|
|||||||
|
|
||||||
export default connect(mapStateToProps, { addLike, removeLike, deletePost })(
|
export default connect(mapStateToProps, { addLike, removeLike, deletePost })(
|
||||||
PostItem
|
PostItem
|
||||||
|
<<<<<<< HEAD
|
||||||
);
|
);
|
||||||
|
=======
|
||||||
|
);
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
|
|||||||
@@ -35,4 +35,8 @@ const mapStateToProps = (state) => ({
|
|||||||
post: state.post
|
post: state.post
|
||||||
});
|
});
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
export default connect(mapStateToProps, { getPosts })(Posts);
|
export default connect(mapStateToProps, { getPosts })(Posts);
|
||||||
|
=======
|
||||||
|
export default connect(mapStateToProps, { getPosts })(Posts);
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
|
|||||||
@@ -34,7 +34,11 @@ const AddEducation = ({ addEducation }) => {
|
|||||||
className="form"
|
className="form"
|
||||||
onSubmit={(e) => {
|
onSubmit={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
<<<<<<< HEAD
|
||||||
|
addEducation(formData).then(() => navigate('/dashboard'));
|
||||||
|
=======
|
||||||
addEducation(formData, navigate);
|
addEducation(formData, navigate);
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
@@ -115,4 +119,8 @@ AddEducation.propTypes = {
|
|||||||
addEducation: PropTypes.func.isRequired
|
addEducation: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
export default connect(null, { addEducation })(AddEducation);
|
export default connect(null, { addEducation })(AddEducation);
|
||||||
|
=======
|
||||||
|
export default connect(null, { addEducation })(AddEducation);
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
|
|||||||
@@ -33,7 +33,11 @@ const AddExperience = ({ addExperience }) => {
|
|||||||
className="form"
|
className="form"
|
||||||
onSubmit={(e) => {
|
onSubmit={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
<<<<<<< HEAD
|
||||||
|
addExperience(formData).then(() => navigate('/dashboard'));
|
||||||
|
=======
|
||||||
addExperience(formData, navigate);
|
addExperience(formData, navigate);
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
@@ -116,4 +120,8 @@ AddExperience.propTypes = {
|
|||||||
addExperience: PropTypes.func.isRequired
|
addExperience: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
export default connect(null, { addExperience })(AddExperience);
|
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 });
|
setFormData({ ...formData, [e.target.name]: e.target.value });
|
||||||
|
|
||||||
const onSubmit = (e) => {
|
const onSubmit = (e) => {
|
||||||
|
<<<<<<< HEAD
|
||||||
|
const editing = profile ? true : false;
|
||||||
|
e.preventDefault();
|
||||||
|
createProfile(formData, editing).then(() => {
|
||||||
|
if (!editing) navigate('/dashboard');
|
||||||
|
});
|
||||||
|
=======
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
createProfile(formData, navigate, profile ? true : false);
|
createProfile(formData, navigate, profile ? true : false);
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -273,4 +281,8 @@ const mapStateToProps = (state) => ({
|
|||||||
|
|
||||||
export default connect(mapStateToProps, { createProfile, getCurrentProfile })(
|
export default connect(mapStateToProps, { createProfile, getCurrentProfile })(
|
||||||
ProfileForm
|
ProfileForm
|
||||||
|
<<<<<<< HEAD
|
||||||
);
|
);
|
||||||
|
=======
|
||||||
|
);
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
|
|||||||
@@ -76,11 +76,19 @@ const Profile = ({ getProfileById, profile: { profile }, auth }) => {
|
|||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
|
=======
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
Profile.propTypes = {
|
Profile.propTypes = {
|
||||||
getProfileById: PropTypes.func.isRequired,
|
getProfileById: PropTypes.func.isRequired,
|
||||||
profile: PropTypes.object.isRequired,
|
profile: PropTypes.object.isRequired,
|
||||||
auth: PropTypes.object.isRequired
|
auth: PropTypes.object.isRequired
|
||||||
};
|
};
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
|
=======
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
const mapStateToProps = (state) => ({
|
const mapStateToProps = (state) => ({
|
||||||
profile: state.profile,
|
profile: state.profile,
|
||||||
auth: state.auth
|
auth: state.auth
|
||||||
|
|||||||
@@ -31,4 +31,8 @@ ProfileAbout.propTypes = {
|
|||||||
profile: PropTypes.object.isRequired
|
profile: PropTypes.object.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
export default ProfileAbout;
|
export default ProfileAbout;
|
||||||
|
=======
|
||||||
|
export default ProfileAbout;
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
|
|||||||
@@ -26,4 +26,8 @@ ProfileEducation.propTypes = {
|
|||||||
education: PropTypes.object.isRequired
|
education: PropTypes.object.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
export default ProfileEducation;
|
export default ProfileEducation;
|
||||||
|
=======
|
||||||
|
export default ProfileEducation;
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
|
|||||||
@@ -26,4 +26,8 @@ ProfileExperience.propTypes = {
|
|||||||
experience: PropTypes.object.isRequired
|
experience: PropTypes.object.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
export default ProfileExperience;
|
export default ProfileExperience;
|
||||||
|
=======
|
||||||
|
export default ProfileExperience;
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
|
|||||||
@@ -48,4 +48,8 @@ const mapStateToProps = state => ({
|
|||||||
repos: state.profile.repos
|
repos: state.profile.repos
|
||||||
});
|
});
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
export default connect(mapStateToProps, { getGithubRepos })(ProfileGithub);
|
export default connect(mapStateToProps, { getGithubRepos })(ProfileGithub);
|
||||||
|
=======
|
||||||
|
export default connect(mapStateToProps, { getGithubRepos })(ProfileGithub);
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
|
|||||||
@@ -48,4 +48,8 @@ ProfileTop.propTypes = {
|
|||||||
profile: PropTypes.object.isRequired
|
profile: PropTypes.object.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
export default ProfileTop;
|
export default ProfileTop;
|
||||||
|
=======
|
||||||
|
export default ProfileTop;
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
|
|||||||
@@ -39,4 +39,8 @@ ProfileItem.propTypes = {
|
|||||||
profile: PropTypes.object.isRequired
|
profile: PropTypes.object.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
export default ProfileItem;
|
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 React from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
@@ -40,3 +90,4 @@ ProfileItem.propTypes = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default ProfileItem;
|
export default ProfileItem;
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
|
|||||||
@@ -22,4 +22,8 @@ const mapStateToProps = (state) => ({
|
|||||||
auth: state.auth
|
auth: state.auth
|
||||||
});
|
});
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
export default connect(mapStateToProps)(PrivateRoute);
|
export default connect(mapStateToProps)(PrivateRoute);
|
||||||
|
=======
|
||||||
|
export default connect(mapStateToProps)(PrivateRoute);
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
|
|||||||
@@ -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 React from "react";
|
||||||
import ReactDOM from "react-dom/client";
|
import ReactDOM from "react-dom/client";
|
||||||
import App from "./App";
|
import App from "./App";
|
||||||
const root = ReactDOM.createRoot(document.getElementById('root'));
|
const root = ReactDOM.createRoot(document.getElementById('root'));
|
||||||
root.render(<App />);
|
root.render(<App />);
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
|
|||||||
@@ -15,4 +15,8 @@ function alertReducer(state = initialState, action) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
export default alertReducer;
|
export default alertReducer;
|
||||||
|
=======
|
||||||
|
export default alertReducer;
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
|
|||||||
@@ -50,4 +50,8 @@ function authReducer(state = initialState, action) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
export default authReducer;
|
export default authReducer;
|
||||||
|
=======
|
||||||
|
export default authReducer;
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
|
|||||||
@@ -9,4 +9,8 @@ export default combineReducers({
|
|||||||
auth,
|
auth,
|
||||||
profile,
|
profile,
|
||||||
post
|
post
|
||||||
|
<<<<<<< HEAD
|
||||||
});
|
});
|
||||||
|
=======
|
||||||
|
});
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
|
|||||||
@@ -1,4 +1,88 @@
|
|||||||
import {
|
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,
|
GET_POSTS,
|
||||||
POST_ERROR,
|
POST_ERROR,
|
||||||
UPDATE_LIKES,
|
UPDATE_LIKES,
|
||||||
@@ -81,3 +165,4 @@ import {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default postReducer;
|
export default postReducer;
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
|
|||||||
@@ -5,15 +5,24 @@ import {
|
|||||||
UPDATE_PROFILE,
|
UPDATE_PROFILE,
|
||||||
GET_PROFILES,
|
GET_PROFILES,
|
||||||
GET_REPOS,
|
GET_REPOS,
|
||||||
|
<<<<<<< HEAD
|
||||||
|
NO_REPOS
|
||||||
|
} from '../actions/types';
|
||||||
|
=======
|
||||||
NO_REPOS,
|
NO_REPOS,
|
||||||
} from "../actions/types";
|
} from "../actions/types";
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
|
|
||||||
const initialState = {
|
const initialState = {
|
||||||
profile: null,
|
profile: null,
|
||||||
profiles: [],
|
profiles: [],
|
||||||
repos: [],
|
repos: [],
|
||||||
loading: true,
|
loading: true,
|
||||||
|
<<<<<<< HEAD
|
||||||
|
error: {}
|
||||||
|
=======
|
||||||
error: {},
|
error: {},
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
};
|
};
|
||||||
|
|
||||||
function profileReducer(state = initialState, action) {
|
function profileReducer(state = initialState, action) {
|
||||||
@@ -25,37 +34,61 @@ function profileReducer(state = initialState, action) {
|
|||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
profile: payload,
|
profile: payload,
|
||||||
|
<<<<<<< HEAD
|
||||||
|
loading: false
|
||||||
|
=======
|
||||||
loading: false,
|
loading: false,
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
};
|
};
|
||||||
case GET_PROFILES:
|
case GET_PROFILES:
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
profiles: payload,
|
profiles: payload,
|
||||||
|
<<<<<<< HEAD
|
||||||
|
loading: false
|
||||||
|
=======
|
||||||
loading: false,
|
loading: false,
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
};
|
};
|
||||||
case PROFILE_ERROR:
|
case PROFILE_ERROR:
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
error: payload,
|
error: payload,
|
||||||
loading: false,
|
loading: false,
|
||||||
|
<<<<<<< HEAD
|
||||||
|
profile: null
|
||||||
|
=======
|
||||||
profile: null,
|
profile: null,
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
};
|
};
|
||||||
case CLEAR_PROFILE:
|
case CLEAR_PROFILE:
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
profile: null,
|
profile: null,
|
||||||
|
<<<<<<< HEAD
|
||||||
|
repos: []
|
||||||
|
=======
|
||||||
repos: [],
|
repos: [],
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
};
|
};
|
||||||
case GET_REPOS:
|
case GET_REPOS:
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
repos: payload,
|
repos: payload,
|
||||||
|
<<<<<<< HEAD
|
||||||
|
loading: false
|
||||||
|
=======
|
||||||
loading: false,
|
loading: false,
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
};
|
};
|
||||||
case NO_REPOS:
|
case NO_REPOS:
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
|
<<<<<<< HEAD
|
||||||
|
repos: []
|
||||||
|
=======
|
||||||
repos: [],
|
repos: [],
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
};
|
};
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
|
|||||||
@@ -36,4 +36,8 @@ store.subscribe(() => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
export default store;
|
export default store;
|
||||||
|
=======
|
||||||
|
export default store;
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
|
|||||||
@@ -2,12 +2,26 @@ import axios from 'axios';
|
|||||||
import store from '../store';
|
import store from '../store';
|
||||||
import { LOGOUT } from '../actions/types';
|
import { LOGOUT } from '../actions/types';
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
// Create an instance of axios
|
||||||
|
=======
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
const api = axios.create({
|
const api = axios.create({
|
||||||
baseURL: '/api',
|
baseURL: '/api',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'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(
|
api.interceptors.response.use(
|
||||||
(res) => res,
|
(res) => res,
|
||||||
|
|||||||
@@ -3,4 +3,7 @@ function formatDate(date) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default formatDate;
|
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";
|
import axios from "axios";
|
||||||
|
|
||||||
const setAuthToken = (token) => {
|
const setAuthToken = (token) => {
|
||||||
@@ -7,6 +20,7 @@ const setAuthToken = (token) => {
|
|||||||
} else {
|
} else {
|
||||||
delete axios.defaults.common["x-auth-token"];
|
delete axios.defaults.common["x-auth-token"];
|
||||||
localStorage.removeItem('token')
|
localStorage.removeItem('token')
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,12 @@
|
|||||||
"start": "node server",
|
"start": "node server",
|
||||||
"server": "nodemon server",
|
"server": "nodemon server",
|
||||||
"client": "npm start --prefix client --trace-depracation",
|
"client": "npm start --prefix client --trace-depracation",
|
||||||
|
<<<<<<< HEAD
|
||||||
|
"dev": "concurrently \"npm run server\" \"npm run client\""
|
||||||
|
=======
|
||||||
"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"
|
"heroku-postbuild":"NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
|
|||||||
@@ -1,16 +1,25 @@
|
|||||||
const express = require('express');
|
const express = require('express');
|
||||||
const connectDB= require('./config/db')
|
const connectDB= require('./config/db')
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
connectDB();
|
connectDB();
|
||||||
|
|
||||||
app.use(express.json({extended:false}));
|
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/users', require('./routers/api/users'))
|
||||||
app.use('/api/auth', require('./routers/api/auth'))
|
app.use('/api/auth', require('./routers/api/auth'))
|
||||||
app.use('/api/profile', require('./routers/api/profile'))
|
app.use('/api/profile', require('./routers/api/profile'))
|
||||||
app.use('/api/posts', require('./routers/api/posts'))
|
app.use('/api/posts', require('./routers/api/posts'))
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
// Serve static assets in production
|
// Serve static assets in production
|
||||||
if (process.env.NODE_ENV==='production'){
|
if (process.env.NODE_ENV==='production'){
|
||||||
app.use(express.static('client/build'));
|
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'))
|
res.sendFile(path.resolve(__dirname, 'client', 'build','index.html'))
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
||||||
const PORT = process.env.PORT || 5000;
|
const PORT = process.env.PORT || 5000;
|
||||||
|
|
||||||
app.listen(PORT,()=> console.log(`Server started on port ${PORT}`));
|
app.listen(PORT,()=> console.log(`Server started on port ${PORT}`));
|
||||||
Reference in New Issue
Block a user