Skip to content

Commit

Permalink
[Refactor] Dont bundle split all of order app
Browse files Browse the repository at this point in the history
  • Loading branch information
damassi committed May 27, 2020
1 parent 4d45870 commit 1f12209
Showing 1 changed file with 21 additions and 50 deletions.
71 changes: 21 additions & 50 deletions src/v2/Apps/Order/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ import { Redirect, RedirectException, RouteConfig } from "found"
import * as React from "react"
import { graphql } from "react-relay"

import RespondRoute from "./Routes/Respond"
import OfferRoute from "./Routes/Offer"
import ShippingRoute from "./Routes/Shipping"
import PaymentRoute from "./Routes/Payment"
import NewPaymentRoute from "./Routes/NewPayment"
import CounterRoute from "./Routes/Counter"
import ReviewRoute from "./Routes/Review"
import AcceptRoute from "./Routes/Accept"
import DeclineRoute from "./Routes/Reject"
import StatusRoute from "./Routes/Status"

const OrderApp = loadable(() => import("./OrderApp"))
const RespondRoute = loadable(() => import("./Routes/Respond"))
const OfferRoute = loadable(() => import("./Routes/Offer"))
const ShippingRoute = loadable(() => import("./Routes/Shipping"))
const PaymentRoute = loadable(() => import("./Routes/Payment"))
const NewPaymentRoute = loadable(() => import("./Routes/NewPayment"))
const CounterRoute = loadable(() => import("./Routes/Counter"))
const ReviewRoute = loadable(() => import("./Routes/Review"))
const AcceptRoute = loadable(() => import("./Routes/Accept"))
const DeclineRoute = loadable(() => import("./Routes/Reject"))
const StatusRoute = loadable(() => import("./Routes/Status"))

// FIXME:
// * `render` functions requires casting
Expand Down Expand Up @@ -74,10 +75,7 @@ export const routes: RouteConfig[] = [
children: [
{
path: "respond",
getComponent: () => RespondRoute,
prepare: () => {
RespondRoute.preload()
},
Component: RespondRoute,
shouldWarnBeforeLeaving: true,
query: graphql`
query routes_RespondQuery($orderID: ID!) {
Expand All @@ -92,10 +90,7 @@ export const routes: RouteConfig[] = [
},
{
path: "offer",
getComponent: () => OfferRoute,
prepare: () => {
OfferRoute.preload()
},
Component: OfferRoute,
shouldWarnBeforeLeaving: true,
query: graphql`
query routes_OfferQuery($orderID: ID!) {
Expand All @@ -110,10 +105,7 @@ export const routes: RouteConfig[] = [
},
{
path: "shipping",
getComponent: () => ShippingRoute,
prepare: () => {
ShippingRoute.preload()
},
Component: ShippingRoute,
shouldWarnBeforeLeaving: true,
query: graphql`
query routes_ShippingQuery($orderID: ID!) {
Expand All @@ -128,10 +120,7 @@ export const routes: RouteConfig[] = [
},
{
path: "payment",
getComponent: () => PaymentRoute,
prepare: () => {
PaymentRoute.preload()
},
Component: PaymentRoute,
shouldWarnBeforeLeaving: true,
query: graphql`
query routes_PaymentQuery($orderID: ID!) {
Expand All @@ -149,10 +138,7 @@ export const routes: RouteConfig[] = [
},
{
path: "payment/new",
getComponent: () => NewPaymentRoute,
prepare: () => {
NewPaymentRoute.preload()
},
Component: NewPaymentRoute,
shouldWarnBeforeLeaving: true,
query: graphql`
query routes_NewPaymentQuery($orderID: ID!) {
Expand All @@ -170,10 +156,7 @@ export const routes: RouteConfig[] = [
},
{
path: "review/counter",
getComponent: () => CounterRoute,
prepare: () => {
CounterRoute.preload()
},
Component: CounterRoute,
shouldWarnBeforeLeaving: true,
query: graphql`
query routes_CounterQuery($orderID: ID!) {
Expand All @@ -188,10 +171,7 @@ export const routes: RouteConfig[] = [
},
{
path: "review",
getComponent: () => ReviewRoute,
prepare: () => {
ReviewRoute.preload()
},
Component: ReviewRoute,
shouldWarnBeforeLeaving: true,
query: graphql`
query routes_ReviewQuery($orderID: ID!) {
Expand All @@ -206,10 +186,7 @@ export const routes: RouteConfig[] = [
},
{
path: "review/accept",
getComponent: () => AcceptRoute,
prepare: () => {
AcceptRoute.preload()
},
Component: AcceptRoute,
query: graphql`
query routes_AcceptQuery($orderID: ID!) {
order: commerceOrder(id: $orderID) {
Expand All @@ -223,10 +200,7 @@ export const routes: RouteConfig[] = [
},
{
path: "review/decline",
getComponent: () => DeclineRoute,
prepare: () => {
DeclineRoute.preload()
},
Component: DeclineRoute,
query: graphql`
query routes_RejectQuery($orderID: ID!) {
order: commerceOrder(id: $orderID) {
Expand All @@ -237,10 +211,7 @@ export const routes: RouteConfig[] = [
},
{
path: "status",
getComponent: () => StatusRoute,
prepare: () => {
StatusRoute.preload()
},
Component: StatusRoute,
query: graphql`
query routes_StatusQuery($orderID: ID!) {
order: commerceOrder(id: $orderID) {
Expand Down

0 comments on commit 1f12209

Please sign in to comment.