Skip to content

Commit

Permalink
Fix profile
Browse files Browse the repository at this point in the history
  • Loading branch information
EslamAsHhraf committed Dec 3, 2022
1 parent 05f1275 commit 6d23c2a
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
.env.development.local
.env.test.local
.env.production.local
.env

npm-debug.log*
yarn-debug.log*
Expand Down
4 changes: 2 additions & 2 deletions data/routes.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"/subreddits/:subredditName/flairs":"/Flair",
"/subreddits/:subredditName/:name/hot":"/hot",
"/subreddits/:Name/subscribe":"/join",
"/subreddits/:Name/Top":"/top",
"/subreddits/:Name/New":"/new",
"/subreddits/:Name/top":"/top",
"/subreddits/:Name/new":"/new",
"/users/signup": "/signup",
"/users/username_available?userName=:username": "/unique",
"/users/me/": "/me",
Expand Down
1 change: 1 addition & 0 deletions src/components/Authentication/authenticationServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const redditCookie = async (setCookie) => {
// set cookie
const date = new Date();
date.setDate(date.getDate() + 90);

setCookie('redditUser', response.data.user, { path: '/', expires: date });
}
// unauthorized =>Redirect to login page
Expand Down
2 changes: 1 addition & 1 deletion src/components/MainProfile/profileServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const postsTapServer = (name) => {
};

export const overviewServer = (name) => {
const [data, dataError, statusCode] = useFetch(`user/${name}/overview`);
const [data, dataError, statusCode] = useFetch(`users/${name}/overview`);

useEffect(() => {
if (statusCode === 401) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/SubReddit/Cover.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function Header() {
useEffect(() => {
console.log(dataError2);

if ((data2?.filter((e) => e.fixedName === fixedName?.toString()))?.length > 0) {
if ((data2?.subreddits?.filter((e) => e.subredditName === Name.toString()))?.length > 0) {
setJoin(true);
} else {
setJoin(false);
Expand Down

0 comments on commit 6d23c2a

Please sign in to comment.