Skip to content

Commit

Permalink
Add create new post with cloudinary image upload
Browse files Browse the repository at this point in the history
  • Loading branch information
beejathon committed Jul 9, 2023
1 parent fa4b05b commit 5daee4a
Show file tree
Hide file tree
Showing 12 changed files with 298 additions and 30 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
REACT_APP_PUBLIC_URL="https://beejathon.github.io/blog-cms"
REACT_APP_API_URI="http://localhost:8080/api"
121 changes: 120 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@
"homepage": "https://beejathon.github.io/blog-cms",
"private": true,
"dependencies": {
"@cloudinary/react": "^1.11.2",
"@cloudinary/url-gen": "^1.10.1",
"@mdi/js": "^7.2.96",
"@mdi/react": "^1.6.1",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"axios": "^1.4.0",
"jwt-decode": "^3.1.2",
"react": "^18.2.0",
"react-bootstrap": "^2.8.0",
Expand Down
7 changes: 2 additions & 5 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import React from "react";
import { PostsProvider } from "./hooks/usePosts";
import { CommmentsProvider } from "./hooks/useComments";
import {
Routes,
Route,
} from "react-router-dom";
import { Routes, Route } from "react-router-dom";
import { Header } from "./components/Header";
import { Home } from "./components/Home";
import { NewPost } from "./components/NewPost";
Expand All @@ -28,7 +25,7 @@ export const App = () => {
<Route path="/:postid" element={<Post />} />
</Routes>
</CommmentsProvider>
</PostsProvider>
</PostsProvider>
</div>
);
}
Expand Down
1 change: 0 additions & 1 deletion src/components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export const Header = () => {
localStorage.removeItem('token');
setUser(null);
setToken(null);

}

return (
Expand Down
8 changes: 4 additions & 4 deletions src/components/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { usePosts } from "../hooks/usePosts";
import { PostCard } from "./PostCard";

export const Home = () => {
const posts = usePosts();
const { posts } = usePosts();

if (!posts) return 'Loading...'

Expand All @@ -16,9 +16,9 @@ export const Home = () => {
<h2 className="h4">All Posts</h2>
{posts.map((post) => {
return (
<div key={post._id}>
<PostCard post={post} />
</div>
<>
<PostCard key={post._id} post={post} />
</>
)
})}
</Stack>
Expand Down
Loading

0 comments on commit 5daee4a

Please sign in to comment.