Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tamasigerald committed Feb 17, 2021
1 parent 873aef6 commit 5ba3f28
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 8 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# REACT_APP_BASE_URL = https://react-inclone-back.herokuapp.com/
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"proxy": "http://localhost:5000/",
"eslintConfig": {
"extends": [
"react-app",
Expand Down
2 changes: 1 addition & 1 deletion src/pages/AddPost/AddPost.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function AddPost() {

const handleSubmit = (e) => {
e.preventDefault();
axios.post('/createpost', post, config)
axios.post(process.env.REACT_APP_BASE_URL + '/createpost', post, config)
.then(function(res) {
addToast(res.data.message, { appearance: 'success', autoDismiss: true });
setTimeout(() => { history.push('/') }, 1500)
Expand Down
2 changes: 1 addition & 1 deletion src/pages/HomePage/HomePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default function HomePage() {

const getPosts = () => {
setIsLoading(true)
axios.get('/allposts')
axios.get(process.env.REACT_APP_BASE_URL + '/allposts')
.then(function(res) {
setPosts(res.data.posts);
setIsLoading(false);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/SignInPage/SignInPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function SignInPage() {
const handleSubmit = (e) => {
e.preventDefault();
const newUser = user;
axios.post('/signin', newUser)
axios.post(process.env.REACT_APP_BASE_URL + '/signin', newUser)
.then(function(res) {
setIsLoading(true)
localStorage.setItem('token', res.data.token);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/SignUpPage/SignUpPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default function SignUpPage() {
const handleSubmit = (e) => {
e.preventDefault();
const newUser = user;
axios.post('/signup', newUser)
axios.post(process.env.REACT_APP_BASE_URL + '/signup', newUser)
.then(function(res) {
addToast(res.data.message, { appearance: 'success', autoDismiss: true });
setTimeout(() => { history.push('/signin') }, 1500)
Expand Down
2 changes: 1 addition & 1 deletion src/pages/UserPage/UserPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function UserPage() {

const getUserPosts = () => {
setIsLoading(true);
axios.get('/userposts', config)
axios.get(process.env.REACT_APP_BASE_URL + '/userposts', config)
.then(function(res) {
setUserPosts(res.data.posts);
setIsLoading(false)
Expand Down
4 changes: 2 additions & 2 deletions src/shared/components/PostCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function PostCard(props) {
}

const likePost = (postId) => {
axios.put('/like', {postId: postId}, config)
axios.put(process.env.REACT_APP_BASE_URL + '/like', {postId: postId}, config)
.then(function(res) {
setNumLikes(res.data.likes.length);
})
Expand All @@ -49,7 +49,7 @@ export default function PostCard(props) {
}

const unlikePost = (postId) => {
axios.put('/unlike', {postId: postId}, config)
axios.put(process.env.REACT_APP_BASE_URL + '/unlike', {postId: postId}, config)
.then(function(res) {
setNumLikes(res.data.likes.length);
})
Expand Down

0 comments on commit 5ba3f28

Please sign in to comment.