-
-
Notifications
You must be signed in to change notification settings - Fork 5
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from "react"; | ||
import { CustomerProvider } from "../context/CustomerContext"; | ||
import { OrderProvider } from "../context/OrderContext"; | ||
import { FlashMessagesProvider } from "../context/FlashMessagesContext"; | ||
|
||
interface AppProvidersProps { | ||
children: React.ReactNode; | ||
} | ||
|
||
const AppProviders: React.FC<AppProvidersProps> = ({ children }) => { | ||
return ( | ||
<CustomerProvider> | ||
<OrderProvider> | ||
<FlashMessagesProvider>{children}</FlashMessagesProvider> | ||
</OrderProvider> | ||
</CustomerProvider> | ||
); | ||
}; | ||
|
||
export default AppProviders; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { useRoutes } from "react-router-dom"; | ||
import { accountRoutes } from "./accountRoutes"; | ||
import { checkoutRoutes, thankYouRoute } from "./checkoutRoutes"; | ||
import { coreRoutes } from "./coreRoutes"; | ||
import { productRoutes } from "./productRoutes"; | ||
|
||
const AppRoutes = () => { | ||
return useRoutes([ | ||
...coreRoutes, | ||
...productRoutes, | ||
checkoutRoutes, | ||
thankYouRoute, | ||
accountRoutes, | ||
]); | ||
}; | ||
|
||
export default AppRoutes; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { RouteObject } from "react-router-dom"; | ||
|
||
import DashboardPage from "../pages/account/DashboardPage"; | ||
import OrderHistoryPage from "../pages/account/OrderHistoryPage"; | ||
import OrderDetailsPage from "../pages/account/OrderDetailsPage"; | ||
import ProfilePage from "../pages/account/ProfilePage"; | ||
import AddressBookPage from "../pages/account/AddressBookPage"; | ||
import AddAddressPage from "../pages/account/AddAddressPage"; | ||
import EditAddressPage from "../pages/account/EditAddressPage"; | ||
import ChangePasswordPage from "../pages/account/ChangePasswordPage"; | ||
|
||
export const accountRoutes: RouteObject = { | ||
path: "account", | ||
children: [ | ||
{ path: "dashboard", element: <DashboardPage /> }, | ||
{ path: "profile/edit", element: <ProfilePage /> }, | ||
10000 { path: "change-password", element: <ChangePasswordPage /> }, | ||
{ path: "order-history", element: <OrderHistoryPage /> }, | ||
{ path: "orders/:token", element: <OrderDetailsPage /> }, | ||
{ path: "address-book", element: <AddressBookPage /> }, | ||
{ path: "address-book/add", element: <AddAddressPage /> }, | ||
{ path: "address-book/edit/:id", element: <EditAddressPage /> }, | ||
], | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { RouteObject } from "react-router-dom"; | ||
import AddressPage from "../pages/Checkout/AddressPage"; | ||
import ShippingPage from "../pages/Checkout/ShippingPage"; | ||
import PaymentPage from "../pages/Checkout/PaymentPage"; | ||
import SummaryPage from "../pages/Checkout/SummaryPage"; | ||
import ThankYouPage from "../pages/Checkout/ThankYouPage"; | ||
|
||
export const checkoutRoutes: RouteObject = { | ||
path: "checkout", | ||
children: [ | ||
{ path: "address", element: <AddressPage /> }, | ||
{ path: "select-shipping", element: <ShippingPage /> }, | ||
{ path: "select-payment", element: <PaymentPage /> }, | ||
{ path: "complete", element: <SummaryPage /> }, | ||
], | ||
}; | ||
|
||
export const thankYouRoute: RouteObject = { | ||
path: "order/thank-you", | ||
element: <ThankYouPage />, | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { RouteObject } from "react-router-dom"; | ||
import Homepage from "../pages/Homepage"; | ||
import CartPage from "../pages/CartPage"; | ||
import LoginPage from "../pages/LoginPage"; | ||
|
||
export const coreRoutes: RouteObject[] = [ | ||
{ path: "/", element: <Homepage /> }, | ||
{ path: "cart", element: <CartPage /> }, | ||
{ path: "login", element: <LoginPage /> }, | ||
]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import ProductList from "../pages/ProductList"; | ||
import ProductPage from "../pages/ProductPage"; | ||
import AddReviewPage from "../pages/Product/AddReviewPage"; | ||
import ReviewsListPage from "../pages/Product/ReviewsListPage"; | ||
|
||
export const productRoutes = [ | ||
{ path: "/:parentCode", element: <ProductList /> }, | ||
{ path: "/:parentCode/:childCode", element: <ProductList /> }, | ||
{ path: "/product/:code", element: <ProductPage /> }, | ||
{ path: "/product/:code/review/new", element: <AddReviewPage /> }, | ||
{ path: "/product/:code/reviews", element: <ReviewsListPage /> }, | ||
]; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Sug
2B74
gestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Refactor router #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor router #19
Changes from all commits
e534805
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.