Skip to content

Sprint 3 routing implementation for User Profile Page#29

Merged
euguenia merged 7 commits intosprint-3_catalog-product-profilefrom
sprint-3_routing-implementation
Aug 31, 2023
Merged

Sprint 3 routing implementation for User Profile Page#29
euguenia merged 7 commits intosprint-3_catalog-product-profilefrom
sprint-3_routing-implementation

Conversation

@euguenia
Copy link
Owner

@euguenia euguenia commented Aug 31, 2023

Sprint [sprint #3]

Task [task #]

Trello task link

Summary

  1. Done 31.08.2023 / Deadline 05.08.2023
  2. Score 15/15

Changelog

add private route for user page

Screenshot

image

@euguenia euguenia requested review from LikeKugi and Nargiza14 August 31, 2023 13:02
Comment on lines 33 to 35
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to use PrivateRoute that renders Outlet in case of Success otherwise it redirects to the main page

Comment on lines 7 to 10
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a better way of PrivateRoute. In this case you can use PrivateRoute to wrap several protected routes

export const PrivateRoute: FC<IPrivateRouteProps> = ({ element, fallbackPath }) => {
    const isLoggedIn = useAppSelector(getLoggedIn);
    if (isLoggedIn ) {
        return <Outlet />;
    } else {
        return <Navigate to={fallbackPath} />;
    }
};

@euguenia euguenia merged commit 0cd1e5d into sprint-3_catalog-product-profile Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments