chore(dashboard): Remove v1 code and medusa-react (#7420)
This commit is contained in:
@@ -48,7 +48,6 @@
|
|||||||
"i18next-browser-languagedetector": "7.2.0",
|
"i18next-browser-languagedetector": "7.2.0",
|
||||||
"i18next-http-backend": "2.4.2",
|
"i18next-http-backend": "2.4.2",
|
||||||
"match-sorter": "^6.3.4",
|
"match-sorter": "^6.3.4",
|
||||||
"medusa-react": "latest",
|
|
||||||
"qs": "^6.12.0",
|
"qs": "^6.12.0",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-country-flag": "^3.1.0",
|
"react-country-flag": "^3.1.0",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { Toaster } from "@medusajs/ui"
|
|||||||
import { QueryClientProvider } from "@tanstack/react-query"
|
import { QueryClientProvider } from "@tanstack/react-query"
|
||||||
|
|
||||||
import { I18n } from "./components/utilities/i18n"
|
import { I18n } from "./components/utilities/i18n"
|
||||||
import { queryClient } from "./lib/medusa"
|
import { queryClient } from "./lib/query-client"
|
||||||
import { RouterProvider } from "./providers/router-provider"
|
import { RouterProvider } from "./providers/router-provider"
|
||||||
import { ThemeProvider } from "./providers/theme-provider"
|
import { ThemeProvider } from "./providers/theme-provider"
|
||||||
|
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
export * from "./require-auth";
|
|
||||||
-34
@@ -1,34 +0,0 @@
|
|||||||
import { Spinner } from "@medusajs/icons"
|
|
||||||
import { Navigate, Outlet, useLocation } from "react-router-dom"
|
|
||||||
|
|
||||||
import { useAdminGetSession } from "medusa-react"
|
|
||||||
import { SearchProvider } from "../../../providers/search-provider"
|
|
||||||
import { SidebarProvider } from "../../../providers/sidebar-provider"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated - Delete once all V1 domains have been migrated to V2.
|
|
||||||
*/
|
|
||||||
export const ProtectedRoute = () => {
|
|
||||||
const { user, isLoading } = useAdminGetSession()
|
|
||||||
const location = useLocation()
|
|
||||||
|
|
||||||
if (isLoading) {
|
|
||||||
return (
|
|
||||||
<div className="flex min-h-screen items-center justify-center">
|
|
||||||
<Spinner className="text-ui-fg-interactive animate-spin" />
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!user) {
|
|
||||||
return <Navigate to="/login" state={{ from: location }} replace />
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<SidebarProvider>
|
|
||||||
<SearchProvider>
|
|
||||||
<Outlet />
|
|
||||||
</SearchProvider>
|
|
||||||
</SidebarProvider>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
+15
-17
@@ -3,13 +3,13 @@ import { Select, Text, clx } from "@medusajs/ui"
|
|||||||
import { useInfiniteQuery } from "@tanstack/react-query"
|
import { useInfiniteQuery } from "@tanstack/react-query"
|
||||||
import { format } from "date-fns"
|
import { format } from "date-fns"
|
||||||
import { debounce } from "lodash"
|
import { debounce } from "lodash"
|
||||||
import { useAdminCustomer } from "medusa-react"
|
|
||||||
import { PropsWithChildren, useCallback, useEffect, useState } from "react"
|
import { PropsWithChildren, useCallback, useEffect, useState } from "react"
|
||||||
import { Control, useWatch } from "react-hook-form"
|
import { Control, useWatch } from "react-hook-form"
|
||||||
import { useTranslation } from "react-i18next"
|
import { useTranslation } from "react-i18next"
|
||||||
|
|
||||||
import { z } from "zod"
|
import { z } from "zod"
|
||||||
import { medusa } from "../../../lib/medusa"
|
|
||||||
|
import { useCustomer } from "../../../hooks/api/customers"
|
||||||
|
import { client } from "../../../lib/client"
|
||||||
import { getStylizedAmount } from "../../../lib/money-amount-helpers"
|
import { getStylizedAmount } from "../../../lib/money-amount-helpers"
|
||||||
import {
|
import {
|
||||||
getOrderFulfillmentStatus,
|
getOrderFulfillmentStatus,
|
||||||
@@ -69,12 +69,12 @@ export const TransferOwnerShipForm = ({
|
|||||||
isLoading: isLoadingOwner,
|
isLoading: isLoadingOwner,
|
||||||
isError: isOwnerError,
|
isError: isOwnerError,
|
||||||
error: ownerError,
|
error: ownerError,
|
||||||
} = useAdminCustomer(currentOwnerId)
|
} = useCustomer(currentOwnerId)
|
||||||
|
|
||||||
const { data, fetchNextPage, isFetchingNextPage } = useInfiniteQuery(
|
const { data, fetchNextPage, isFetchingNextPage } = useInfiniteQuery({
|
||||||
["customers", debouncedQuery],
|
queryKey: ["customers", debouncedQuery],
|
||||||
async ({ pageParam = 0 }) => {
|
queryFn: async ({ pageParam = 0 }) => {
|
||||||
const res = await medusa.admin.customers.list({
|
const res = await client.customers.list({
|
||||||
q: debouncedQuery,
|
q: debouncedQuery,
|
||||||
limit: 10,
|
limit: 10,
|
||||||
offset: pageParam,
|
offset: pageParam,
|
||||||
@@ -82,15 +82,13 @@ export const TransferOwnerShipForm = ({
|
|||||||
})
|
})
|
||||||
return res
|
return res
|
||||||
},
|
},
|
||||||
{
|
initialPageParam: 0,
|
||||||
getNextPageParam: (lastPage) => {
|
getNextPageParam: (lastPage) => {
|
||||||
const moreCustomersExist =
|
const moreCustomersExist =
|
||||||
lastPage.count > lastPage.offset + lastPage.limit
|
lastPage.count > lastPage.offset + lastPage.limit
|
||||||
return moreCustomersExist ? lastPage.offset + lastPage.limit : undefined
|
return moreCustomersExist ? lastPage.offset + lastPage.limit : undefined
|
||||||
},
|
},
|
||||||
keepPreviousData: true,
|
})
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
const createLabel = (customer?: Customer) => {
|
const createLabel = (customer?: Customer) => {
|
||||||
if (!customer) {
|
if (!customer) {
|
||||||
|
|||||||
@@ -24,12 +24,12 @@ import {
|
|||||||
|
|
||||||
import { Skeleton } from "../../common/skeleton"
|
import { Skeleton } from "../../common/skeleton"
|
||||||
|
|
||||||
|
import { useLogout } from "../../../hooks/api/auth"
|
||||||
import { useMe } from "../../../hooks/api/users"
|
import { useMe } from "../../../hooks/api/users"
|
||||||
|
import { queryClient } from "../../../lib/query-client"
|
||||||
import { useSearch } from "../../../providers/search-provider"
|
import { useSearch } from "../../../providers/search-provider"
|
||||||
import { useSidebar } from "../../../providers/sidebar-provider"
|
import { useSidebar } from "../../../providers/sidebar-provider"
|
||||||
import { useTheme } from "../../../providers/theme-provider"
|
import { useTheme } from "../../../providers/theme-provider"
|
||||||
import { useLogout } from "../../../hooks/api/auth"
|
|
||||||
import { queryClient } from "../../../lib/medusa"
|
|
||||||
|
|
||||||
export const Shell = ({ children }: PropsWithChildren) => {
|
export const Shell = ({ children }: PropsWithChildren) => {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { AdminApiKeyListResponse, AdminApiKeyResponse } from "@medusajs/types"
|
||||||
import {
|
import {
|
||||||
MutationOptions,
|
MutationOptions,
|
||||||
QueryKey,
|
QueryKey,
|
||||||
@@ -7,11 +8,10 @@ import {
|
|||||||
useQuery,
|
useQuery,
|
||||||
} from "@tanstack/react-query"
|
} from "@tanstack/react-query"
|
||||||
import { client } from "../../lib/client"
|
import { client } from "../../lib/client"
|
||||||
import { queryClient } from "../../lib/medusa"
|
import { queryClient } from "../../lib/query-client"
|
||||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||||
import { CreateApiKeyReq, UpdateApiKeyReq } from "../../types/api-payloads"
|
import { CreateApiKeyReq, UpdateApiKeyReq } from "../../types/api-payloads"
|
||||||
import { ApiKeyDeleteRes } from "../../types/api-responses"
|
import { ApiKeyDeleteRes } from "../../types/api-responses"
|
||||||
import { AdminApiKeyResponse, AdminApiKeyListResponse } from "@medusajs/types"
|
|
||||||
import { salesChannelsQueryKeys } from "./sales-channels"
|
import { salesChannelsQueryKeys } from "./sales-channels"
|
||||||
|
|
||||||
const API_KEYS_QUERY_KEY = "api_keys" as const
|
const API_KEYS_QUERY_KEY = "api_keys" as const
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import {
|
|||||||
useQuery,
|
useQuery,
|
||||||
} from "@tanstack/react-query"
|
} from "@tanstack/react-query"
|
||||||
import { client } from "../../lib/client"
|
import { client } from "../../lib/client"
|
||||||
import { queryClient } from "../../lib/medusa"
|
import { queryClient } from "../../lib/query-client"
|
||||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||||
import { CreateCampaignReq, UpdateCampaignReq } from "../../types/api-payloads"
|
import { CreateCampaignReq, UpdateCampaignReq } from "../../types/api-payloads"
|
||||||
import { CampaignDeleteRes } from "../../types/api-responses"
|
import { CampaignDeleteRes } from "../../types/api-responses"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
useQuery,
|
useQuery,
|
||||||
} from "@tanstack/react-query"
|
} from "@tanstack/react-query"
|
||||||
import { client } from "../../lib/client"
|
import { client } from "../../lib/client"
|
||||||
import { queryClient } from "../../lib/medusa"
|
import { queryClient } from "../../lib/query-client"
|
||||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||||
import {
|
import {
|
||||||
CreateProductCollectionReq,
|
CreateProductCollectionReq,
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
import {
|
||||||
|
AdminCustomerGroupListResponse,
|
||||||
|
AdminCustomerGroupResponse,
|
||||||
|
} from "@medusajs/types"
|
||||||
import {
|
import {
|
||||||
QueryKey,
|
QueryKey,
|
||||||
UseMutationOptions,
|
UseMutationOptions,
|
||||||
@@ -5,16 +9,12 @@ import {
|
|||||||
useMutation,
|
useMutation,
|
||||||
useQuery,
|
useQuery,
|
||||||
} from "@tanstack/react-query"
|
} from "@tanstack/react-query"
|
||||||
import { client } from "../../lib/client"
|
|
||||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
|
||||||
import {
|
|
||||||
AdminCustomerGroupListResponse,
|
|
||||||
AdminCustomerGroupResponse,
|
|
||||||
} from "@medusajs/types"
|
|
||||||
import { z } from "zod"
|
import { z } from "zod"
|
||||||
import { CreateCustomerGroupSchema } from "../../v2-routes/customer-groups/customer-group-create/components/create-customer-group-form"
|
import { client } from "../../lib/client"
|
||||||
import { queryClient } from "../../lib/medusa"
|
import { queryClient } from "../../lib/query-client"
|
||||||
import { EditCustomerGroupSchema } from "../../v2-routes/customer-groups/customer-group-edit/components/edit-customer-group-form"
|
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||||
|
import { CreateCustomerGroupSchema } from "../../routes/customer-groups/customer-group-create/components/create-customer-group-form"
|
||||||
|
import { EditCustomerGroupSchema } from "../../routes/customer-groups/customer-group-edit/components/edit-customer-group-form"
|
||||||
import { customersQueryKeys } from "./customers"
|
import { customersQueryKeys } from "./customers"
|
||||||
|
|
||||||
const CUSTOMER_GROUPS_QUERY_KEY = "customer_groups" as const
|
const CUSTOMER_GROUPS_QUERY_KEY = "customer_groups" as const
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import {
|
|||||||
useQuery,
|
useQuery,
|
||||||
} from "@tanstack/react-query"
|
} from "@tanstack/react-query"
|
||||||
import { client } from "../../lib/client"
|
import { client } from "../../lib/client"
|
||||||
import { queryClient } from "../../lib/medusa"
|
import { queryClient } from "../../lib/query-client"
|
||||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||||
import { CreateCustomerReq, UpdateCustomerReq } from "../../types/api-payloads"
|
import { CreateCustomerReq, UpdateCustomerReq } from "../../types/api-payloads"
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { useMutation, UseMutationOptions } from "@tanstack/react-query"
|
|||||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||||
|
|
||||||
import { client } from "../../lib/client"
|
import { client } from "../../lib/client"
|
||||||
import { queryClient } from "../../lib/medusa"
|
import { queryClient } from "../../lib/query-client"
|
||||||
import { ordersQueryKeys } from "./orders"
|
import { ordersQueryKeys } from "./orders"
|
||||||
|
|
||||||
const FULFILLMENTS_QUERY_KEY = "fulfillments" as const
|
const FULFILLMENTS_QUERY_KEY = "fulfillments" as const
|
||||||
|
|||||||
@@ -1,15 +1,4 @@
|
|||||||
import { AdminInventoryItemResponse, InventoryNext } from "@medusajs/types"
|
import { AdminInventoryItemResponse, InventoryNext } from "@medusajs/types"
|
||||||
import {
|
|
||||||
InventoryItemDeleteRes,
|
|
||||||
InventoryItemListRes,
|
|
||||||
InventoryItemLocationLevelsRes,
|
|
||||||
InventoryItemRes,
|
|
||||||
} from "../../types/api-responses"
|
|
||||||
import {
|
|
||||||
InventoryItemLocationBatch,
|
|
||||||
UpdateInventoryItemReq,
|
|
||||||
UpdateInventoryLevelReq,
|
|
||||||
} from "../../types/api-payloads"
|
|
||||||
import {
|
import {
|
||||||
QueryKey,
|
QueryKey,
|
||||||
UseMutationOptions,
|
UseMutationOptions,
|
||||||
@@ -17,9 +6,20 @@ import {
|
|||||||
useMutation,
|
useMutation,
|
||||||
useQuery,
|
useQuery,
|
||||||
} from "@tanstack/react-query"
|
} from "@tanstack/react-query"
|
||||||
|
import {
|
||||||
|
InventoryItemLocationBatch,
|
||||||
|
UpdateInventoryItemReq,
|
||||||
|
UpdateInventoryLevelReq,
|
||||||
|
} from "../../types/api-payloads"
|
||||||
|
import {
|
||||||
|
InventoryItemDeleteRes,
|
||||||
|
InventoryItemListRes,
|
||||||
|
InventoryItemLocationLevelsRes,
|
||||||
|
InventoryItemRes,
|
||||||
|
} from "../../types/api-responses"
|
||||||
|
|
||||||
import { client } from "../../lib/client"
|
import { client } from "../../lib/client"
|
||||||
import { queryClient } from "../../lib/medusa"
|
import { queryClient } from "../../lib/query-client"
|
||||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||||
|
|
||||||
const INVENTORY_ITEMS_QUERY_KEY = "inventory_items" as const
|
const INVENTORY_ITEMS_QUERY_KEY = "inventory_items" as const
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
import {
|
||||||
|
AdminInviteResponse,
|
||||||
|
DeleteResponse,
|
||||||
|
HttpTypes,
|
||||||
|
PaginatedResponse,
|
||||||
|
} from "@medusajs/types"
|
||||||
import {
|
import {
|
||||||
QueryKey,
|
QueryKey,
|
||||||
UseMutationOptions,
|
UseMutationOptions,
|
||||||
@@ -6,14 +12,8 @@ import {
|
|||||||
useQuery,
|
useQuery,
|
||||||
} from "@tanstack/react-query"
|
} from "@tanstack/react-query"
|
||||||
import { sdk } from "../../lib/client"
|
import { sdk } from "../../lib/client"
|
||||||
import { queryClient } from "../../lib/medusa"
|
import { queryClient } from "../../lib/query-client"
|
||||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||||
import {
|
|
||||||
AdminInviteResponse,
|
|
||||||
DeleteResponse,
|
|
||||||
HttpTypes,
|
|
||||||
PaginatedResponse,
|
|
||||||
} from "@medusajs/types"
|
|
||||||
|
|
||||||
const INVITES_QUERY_KEY = "invites" as const
|
const INVITES_QUERY_KEY = "invites" as const
|
||||||
const invitesQueryKeys = queryKeysFactory(INVITES_QUERY_KEY)
|
const invitesQueryKeys = queryKeysFactory(INVITES_QUERY_KEY)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { QueryKey, useQuery, UseQueryOptions } from "@tanstack/react-query"
|
import { QueryKey, useQuery, UseQueryOptions } from "@tanstack/react-query"
|
||||||
|
|
||||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
|
||||||
import { client } from "../../lib/client"
|
import { client } from "../../lib/client"
|
||||||
|
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||||
|
|
||||||
const ORDERS_QUERY_KEY = "orders" as const
|
const ORDERS_QUERY_KEY = "orders" as const
|
||||||
export const ordersQueryKeys = queryKeysFactory(ORDERS_QUERY_KEY)
|
export const ordersQueryKeys = queryKeysFactory(ORDERS_QUERY_KEY)
|
||||||
@@ -15,7 +15,7 @@ export const useOrder = (
|
|||||||
>
|
>
|
||||||
) => {
|
) => {
|
||||||
const { data, ...rest } = useQuery({
|
const { data, ...rest } = useQuery({
|
||||||
queryFn: () => client.orders.retrieve(id, query),
|
queryFn: async () => client.orders.retrieve(id, query),
|
||||||
queryKey: ordersQueryKeys.detail(id, query),
|
queryKey: ordersQueryKeys.detail(id, query),
|
||||||
...options,
|
...options,
|
||||||
})
|
})
|
||||||
@@ -31,7 +31,7 @@ export const useOrders = (
|
|||||||
>
|
>
|
||||||
) => {
|
) => {
|
||||||
const { data, ...rest } = useQuery({
|
const { data, ...rest } = useQuery({
|
||||||
queryFn: () => client.orders.list(query),
|
queryFn: async () => client.orders.list(query),
|
||||||
queryKey: ordersQueryKeys.list(query),
|
queryKey: ordersQueryKeys.list(query),
|
||||||
...options,
|
...options,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
useQuery,
|
useQuery,
|
||||||
} from "@tanstack/react-query"
|
} from "@tanstack/react-query"
|
||||||
import { client } from "../../lib/client"
|
import { client } from "../../lib/client"
|
||||||
import { queryClient } from "../../lib/medusa"
|
import { queryClient } from "../../lib/query-client"
|
||||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||||
import {
|
import {
|
||||||
AddPriceListPricesReq,
|
AddPriceListPricesReq,
|
||||||
|
|||||||
@@ -6,9 +6,13 @@ import {
|
|||||||
useQuery,
|
useQuery,
|
||||||
} from "@tanstack/react-query"
|
} from "@tanstack/react-query"
|
||||||
import { client } from "../../lib/client"
|
import { client } from "../../lib/client"
|
||||||
|
import { queryClient } from "../../lib/query-client"
|
||||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||||
import { ProductDeleteRes, ProductRes } from "../../types/api-responses"
|
import {
|
||||||
import { queryClient } from "../../lib/medusa"
|
ProductDeleteRes,
|
||||||
|
ProductListRes,
|
||||||
|
ProductRes,
|
||||||
|
} from "../../types/api-responses"
|
||||||
|
|
||||||
const PRODUCTS_QUERY_KEY = "products" as const
|
const PRODUCTS_QUERY_KEY = "products" as const
|
||||||
export const productsQueryKeys = queryKeysFactory(PRODUCTS_QUERY_KEY)
|
export const productsQueryKeys = queryKeysFactory(PRODUCTS_QUERY_KEY)
|
||||||
@@ -200,7 +204,7 @@ export const useProduct = (
|
|||||||
export const useProducts = (
|
export const useProducts = (
|
||||||
query?: Record<string, any>,
|
query?: Record<string, any>,
|
||||||
options?: Omit<
|
options?: Omit<
|
||||||
UseQueryOptions<any, Error, any, QueryKey>,
|
UseQueryOptions<ProductListRes, Error, ProductListRes, QueryKey>,
|
||||||
"queryFn" | "queryKey"
|
"queryFn" | "queryKey"
|
||||||
>
|
>
|
||||||
) => {
|
) => {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
UseQueryOptions,
|
UseQueryOptions,
|
||||||
} from "@tanstack/react-query"
|
} from "@tanstack/react-query"
|
||||||
import { client } from "../../lib/client"
|
import { client } from "../../lib/client"
|
||||||
import { queryClient } from "../../lib/medusa"
|
import { queryClient } from "../../lib/query-client"
|
||||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||||
import {
|
import {
|
||||||
BatchAddPromotionRulesReq,
|
BatchAddPromotionRulesReq,
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { DeleteResponse, HttpTypes, PaginatedResponse } from "@medusajs/types"
|
||||||
import {
|
import {
|
||||||
QueryKey,
|
QueryKey,
|
||||||
UseMutationOptions,
|
UseMutationOptions,
|
||||||
@@ -6,12 +7,11 @@ import {
|
|||||||
useQuery,
|
useQuery,
|
||||||
} from "@tanstack/react-query"
|
} from "@tanstack/react-query"
|
||||||
import { sdk } from "../../lib/client"
|
import { sdk } from "../../lib/client"
|
||||||
import { queryClient } from "../../lib/medusa"
|
import { queryClient } from "../../lib/query-client"
|
||||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||||
import { DeleteResponse, HttpTypes, PaginatedResponse } from "@medusajs/types"
|
|
||||||
|
|
||||||
const REGIONS_QUERY_KEY = "regions" as const
|
const REGIONS_QUERY_KEY = "regions" as const
|
||||||
const regionsQueryKeys = queryKeysFactory(REGIONS_QUERY_KEY)
|
export const regionsQueryKeys = queryKeysFactory(REGIONS_QUERY_KEY)
|
||||||
|
|
||||||
export const useRegion = (
|
export const useRegion = (
|
||||||
id: string,
|
id: string,
|
||||||
|
|||||||
@@ -1,7 +1,3 @@
|
|||||||
import {
|
|
||||||
CreateReservationReq,
|
|
||||||
UpdateReservationReq,
|
|
||||||
} from "../../types/api-payloads"
|
|
||||||
import {
|
import {
|
||||||
QueryKey,
|
QueryKey,
|
||||||
UseMutationOptions,
|
UseMutationOptions,
|
||||||
@@ -9,6 +5,10 @@ import {
|
|||||||
useMutation,
|
useMutation,
|
||||||
useQuery,
|
useQuery,
|
||||||
} from "@tanstack/react-query"
|
} from "@tanstack/react-query"
|
||||||
|
import {
|
||||||
|
CreateReservationReq,
|
||||||
|
UpdateReservationReq,
|
||||||
|
} from "../../types/api-payloads"
|
||||||
import {
|
import {
|
||||||
ReservationItemDeleteRes,
|
ReservationItemDeleteRes,
|
||||||
ReservationItemListRes,
|
ReservationItemListRes,
|
||||||
@@ -17,7 +17,7 @@ import {
|
|||||||
|
|
||||||
import { InventoryNext } from "@medusajs/types"
|
import { InventoryNext } from "@medusajs/types"
|
||||||
import { client } from "../../lib/client"
|
import { client } from "../../lib/client"
|
||||||
import { queryClient } from "../../lib/medusa"
|
import { queryClient } from "../../lib/query-client"
|
||||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||||
|
|
||||||
const RESERVATION_ITEMS_QUERY_KEY = "reservation_items" as const
|
const RESERVATION_ITEMS_QUERY_KEY = "reservation_items" as const
|
||||||
|
|||||||
@@ -6,8 +6,12 @@ import {
|
|||||||
useQuery,
|
useQuery,
|
||||||
} from "@tanstack/react-query"
|
} from "@tanstack/react-query"
|
||||||
|
|
||||||
|
import {
|
||||||
|
AdminSalesChannelListResponse,
|
||||||
|
AdminSalesChannelResponse,
|
||||||
|
} from "@medusajs/types"
|
||||||
import { client } from "../../lib/client"
|
import { client } from "../../lib/client"
|
||||||
import { queryClient } from "../../lib/medusa"
|
import { queryClient } from "../../lib/query-client"
|
||||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||||
import {
|
import {
|
||||||
AddProductsSalesChannelReq,
|
AddProductsSalesChannelReq,
|
||||||
@@ -17,10 +21,6 @@ import {
|
|||||||
} from "../../types/api-payloads"
|
} from "../../types/api-payloads"
|
||||||
import { SalesChannelDeleteRes } from "../../types/api-responses"
|
import { SalesChannelDeleteRes } from "../../types/api-responses"
|
||||||
import { productsQueryKeys } from "./products"
|
import { productsQueryKeys } from "./products"
|
||||||
import {
|
|
||||||
AdminSalesChannelListResponse,
|
|
||||||
AdminSalesChannelResponse,
|
|
||||||
} from "@medusajs/types"
|
|
||||||
|
|
||||||
const SALES_CHANNELS_QUERY_KEY = "sales-channels" as const
|
const SALES_CHANNELS_QUERY_KEY = "sales-channels" as const
|
||||||
export const salesChannelsQueryKeys = queryKeysFactory(SALES_CHANNELS_QUERY_KEY)
|
export const salesChannelsQueryKeys = queryKeysFactory(SALES_CHANNELS_QUERY_KEY)
|
||||||
|
|||||||
@@ -6,17 +6,17 @@ import {
|
|||||||
UseQueryOptions,
|
UseQueryOptions,
|
||||||
} from "@tanstack/react-query"
|
} from "@tanstack/react-query"
|
||||||
|
|
||||||
import {
|
import { client } from "../../lib/client"
|
||||||
ShippingOptionDeleteRes,
|
import { queryClient } from "../../lib/query-client"
|
||||||
ShippingOptionRes,
|
|
||||||
} from "../../types/api-responses"
|
|
||||||
import {
|
import {
|
||||||
CreateShippingOptionReq,
|
CreateShippingOptionReq,
|
||||||
UpdateShippingOptionReq,
|
UpdateShippingOptionReq,
|
||||||
} from "../../types/api-payloads"
|
} from "../../types/api-payloads"
|
||||||
|
import {
|
||||||
|
ShippingOptionDeleteRes,
|
||||||
|
ShippingOptionRes,
|
||||||
|
} from "../../types/api-responses"
|
||||||
import { stockLocationsQueryKeys } from "./stock-locations"
|
import { stockLocationsQueryKeys } from "./stock-locations"
|
||||||
import { queryClient } from "../../lib/medusa"
|
|
||||||
import { client } from "../../lib/client"
|
|
||||||
|
|
||||||
export const useShippingOptions = (
|
export const useShippingOptions = (
|
||||||
query?: Record<string, any>,
|
query?: Record<string, any>,
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import {
|
|||||||
|
|
||||||
import { DeleteResponse } from "@medusajs/types"
|
import { DeleteResponse } from "@medusajs/types"
|
||||||
import { client } from "../../lib/client"
|
import { client } from "../../lib/client"
|
||||||
import { queryClient } from "../../lib/medusa"
|
import { queryClient } from "../../lib/query-client"
|
||||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||||
|
|
||||||
const SHIPPING_PROFILE_QUERY_KEY = "shipping_profile" as const
|
const SHIPPING_PROFILE_QUERY_KEY = "shipping_profile" as const
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
} from "@tanstack/react-query"
|
} from "@tanstack/react-query"
|
||||||
|
|
||||||
import { client } from "../../lib/client"
|
import { client } from "../../lib/client"
|
||||||
import { queryClient } from "../../lib/medusa"
|
import { queryClient } from "../../lib/query-client"
|
||||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||||
import {
|
import {
|
||||||
CreateFulfillmentSetReq,
|
CreateFulfillmentSetReq,
|
||||||
@@ -24,7 +24,6 @@ import {
|
|||||||
StockLocationListRes,
|
StockLocationListRes,
|
||||||
StockLocationRes,
|
StockLocationRes,
|
||||||
} from "../../types/api-responses"
|
} from "../../types/api-responses"
|
||||||
import { salesChannelsQueryKeys } from "./sales-channels"
|
|
||||||
|
|
||||||
const STOCK_LOCATIONS_QUERY_KEY = "stock_locations" as const
|
const STOCK_LOCATIONS_QUERY_KEY = "stock_locations" as const
|
||||||
export const stockLocationsQueryKeys = queryKeysFactory(
|
export const stockLocationsQueryKeys = queryKeysFactory(
|
||||||
|
|||||||
@@ -7,13 +7,13 @@ import {
|
|||||||
} from "@tanstack/react-query"
|
} from "@tanstack/react-query"
|
||||||
|
|
||||||
import { client } from "../../lib/client"
|
import { client } from "../../lib/client"
|
||||||
import { queryClient } from "../../lib/medusa"
|
import { queryClient } from "../../lib/query-client"
|
||||||
|
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||||
import { UpdateStoreReq } from "../../types/api-payloads"
|
import { UpdateStoreReq } from "../../types/api-payloads"
|
||||||
import { StoreRes } from "../../types/api-responses"
|
import { StoreRes } from "../../types/api-responses"
|
||||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
|
||||||
|
|
||||||
const STORE_QUERY_KEY = "store" as const
|
const STORE_QUERY_KEY = "store" as const
|
||||||
const storeQueryKeys = queryKeysFactory(STORE_QUERY_KEY)
|
export const storeQueryKeys = queryKeysFactory(STORE_QUERY_KEY)
|
||||||
|
|
||||||
export const useStore = (
|
export const useStore = (
|
||||||
options?: Omit<
|
options?: Omit<
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ import {
|
|||||||
import { AdminTaxRateListResponse, AdminTaxRateResponse } from "@medusajs/types"
|
import { AdminTaxRateListResponse, AdminTaxRateResponse } from "@medusajs/types"
|
||||||
import {
|
import {
|
||||||
QueryKey,
|
QueryKey,
|
||||||
useMutation,
|
|
||||||
UseMutationOptions,
|
UseMutationOptions,
|
||||||
useQuery,
|
|
||||||
UseQueryOptions,
|
UseQueryOptions,
|
||||||
|
useMutation,
|
||||||
|
useQuery,
|
||||||
} from "@tanstack/react-query"
|
} from "@tanstack/react-query"
|
||||||
import { client } from "../../lib/client"
|
import { client } from "../../lib/client"
|
||||||
import { queryClient } from "../../lib/medusa"
|
import { queryClient } from "../../lib/query-client"
|
||||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||||
import { TaxRateDeleteRes } from "../../types/api-responses"
|
import { TaxRateDeleteRes } from "../../types/api-responses"
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import {
|
|||||||
useQuery,
|
useQuery,
|
||||||
} from "@tanstack/react-query"
|
} from "@tanstack/react-query"
|
||||||
import { client } from "../../lib/client"
|
import { client } from "../../lib/client"
|
||||||
import { queryClient } from "../../lib/medusa"
|
import { queryClient } from "../../lib/query-client"
|
||||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||||
import { TaxRegionDeleteRes } from "../../types/api-responses"
|
import { TaxRegionDeleteRes } from "../../types/api-responses"
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
useQuery,
|
useQuery,
|
||||||
} from "@tanstack/react-query"
|
} from "@tanstack/react-query"
|
||||||
import { client } from "../../lib/client"
|
import { client } from "../../lib/client"
|
||||||
import { queryClient } from "../../lib/medusa"
|
import { queryClient } from "../../lib/query-client"
|
||||||
import { queryKeysFactory } from "../../lib/query-key-factory"
|
import { queryKeysFactory } from "../../lib/query-key-factory"
|
||||||
import { UpdateUserReq } from "../../types/api-payloads"
|
import { UpdateUserReq } from "../../types/api-payloads"
|
||||||
import { UserDeleteRes, UserListRes, UserRes } from "../../types/api-responses"
|
import { UserDeleteRes, UserListRes, UserRes } from "../../types/api-responses"
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
} from "../../types/api-responses"
|
} from "../../types/api-responses"
|
||||||
|
|
||||||
const WORKFLOW_EXECUTIONS_QUERY_KEY = "workflow_executions" as const
|
const WORKFLOW_EXECUTIONS_QUERY_KEY = "workflow_executions" as const
|
||||||
const workflowExecutionsQueryKeys = queryKeysFactory(
|
export const workflowExecutionsQueryKeys = queryKeysFactory(
|
||||||
WORKFLOW_EXECUTIONS_QUERY_KEY
|
WORKFLOW_EXECUTIONS_QUERY_KEY
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@ import {
|
|||||||
getCategoryPath,
|
getCategoryPath,
|
||||||
getIsActiveProps,
|
getIsActiveProps,
|
||||||
getIsInternalProps,
|
getIsInternalProps,
|
||||||
} from "../../../v2-routes/categories/common/utils"
|
} from "../../../routes/categories/common/utils"
|
||||||
|
|
||||||
const columnHelper =
|
const columnHelper =
|
||||||
createColumnHelper<AdminProductCategoryResponse["product_category"]>()
|
createColumnHelper<AdminProductCategoryResponse["product_category"]>()
|
||||||
|
|||||||
@@ -1,57 +0,0 @@
|
|||||||
import {
|
|
||||||
AdminCampaignRes,
|
|
||||||
AdminCampaignsListRes,
|
|
||||||
AdminGetCampaignsCampaignParams,
|
|
||||||
AdminGetCampaignsParams,
|
|
||||||
AdminPostCampaignsCampaignReq,
|
|
||||||
} from "@medusajs/medusa"
|
|
||||||
import { useMutation } from "@tanstack/react-query"
|
|
||||||
import { queryKeysFactory, useAdminCustomQuery } from "medusa-react"
|
|
||||||
import { medusa } from "../medusa"
|
|
||||||
|
|
||||||
const QUERY_KEY = "admin_campaigns"
|
|
||||||
export const adminCampaignKeys = queryKeysFactory<
|
|
||||||
typeof QUERY_KEY,
|
|
||||||
AdminGetCampaignsParams
|
|
||||||
>(QUERY_KEY)
|
|
||||||
|
|
||||||
export const adminCampaignQueryFns = {
|
|
||||||
list: (query: AdminGetCampaignsParams) =>
|
|
||||||
medusa.admin.custom.get(`/admin/campaigns`, query),
|
|
||||||
detail: (id: string) => medusa.admin.custom.get(`/admin/campaigns/${id}`),
|
|
||||||
}
|
|
||||||
|
|
||||||
export const useV2Campaigns = (
|
|
||||||
query?: AdminGetCampaignsParams,
|
|
||||||
options?: object
|
|
||||||
) => {
|
|
||||||
const { data, ...rest } = useAdminCustomQuery<
|
|
||||||
AdminGetCampaignsParams,
|
|
||||||
AdminCampaignsListRes
|
|
||||||
>("/admin/campaigns", adminCampaignKeys.list(query), query, options)
|
|
||||||
|
|
||||||
return { ...data, ...rest }
|
|
||||||
}
|
|
||||||
|
|
||||||
export const useV2Campaign = (
|
|
||||||
id: string,
|
|
||||||
query?: AdminGetCampaignsParams,
|
|
||||||
options?: object
|
|
||||||
) => {
|
|
||||||
const { data, ...rest } = useAdminCustomQuery<
|
|
||||||
AdminGetCampaignsCampaignParams,
|
|
||||||
AdminCampaignRes
|
|
||||||
>(`/admin/campaigns/${id}`, adminCampaignKeys.detail(id), query, options)
|
|
||||||
|
|
||||||
return { ...data, ...rest }
|
|
||||||
}
|
|
||||||
|
|
||||||
export const useV2DeleteCampaign = (id: string) => {
|
|
||||||
return useMutation(() => medusa.admin.custom.delete(`/admin/campaigns/${id}`))
|
|
||||||
}
|
|
||||||
|
|
||||||
export const useV2PostCampaign = (id: string) => {
|
|
||||||
return useMutation((args: AdminPostCampaignsCampaignReq) =>
|
|
||||||
medusa.client.request("POST", `/admin/campaigns/${id}`, args)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
import { CurrencyDTO } from "@medusajs/types"
|
|
||||||
import { adminCurrenciesKeys, useAdminCustomQuery } from "medusa-react"
|
|
||||||
import { V2ListRes } from "./types/common"
|
|
||||||
|
|
||||||
// TODO: Add types once we export V2 API types
|
|
||||||
export const useV2Currencies = (query?: any, options?: any) => {
|
|
||||||
const { data, ...rest } = useAdminCustomQuery(
|
|
||||||
`/admin/currencies`,
|
|
||||||
adminCurrenciesKeys.list(query),
|
|
||||||
query,
|
|
||||||
options
|
|
||||||
)
|
|
||||||
|
|
||||||
const typedData: {
|
|
||||||
currencies: CurrencyDTO[] | undefined
|
|
||||||
} & V2ListRes = {
|
|
||||||
currencies: data?.currencies,
|
|
||||||
count: data?.count,
|
|
||||||
offset: data?.offset,
|
|
||||||
limit: data?.limit,
|
|
||||||
}
|
|
||||||
|
|
||||||
return { ...typedData, ...rest }
|
|
||||||
}
|
|
||||||
|
|
||||||
export const useV2Currency = (id: string, options?: any) => {
|
|
||||||
const { data, ...rest } = useAdminCustomQuery(
|
|
||||||
`/admin/currencies/${id}`,
|
|
||||||
adminCurrenciesKeys.detail(id),
|
|
||||||
undefined,
|
|
||||||
options
|
|
||||||
)
|
|
||||||
|
|
||||||
const currency: CurrencyDTO | undefined = data?.currency
|
|
||||||
|
|
||||||
return { currency, ...rest }
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
export * from "./auth"
|
|
||||||
export * from "./campaign"
|
|
||||||
export * from "./currencies"
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
export type AcceptInviteInput = {
|
|
||||||
payload: {
|
|
||||||
first_name: string
|
|
||||||
last_name: string
|
|
||||||
}
|
|
||||||
// Token for the created auth user
|
|
||||||
token: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export type CreateAuthUserInput = {
|
|
||||||
email: string
|
|
||||||
password: string
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
export type V2ListRes = {
|
|
||||||
count: number | undefined
|
|
||||||
offset: number | undefined
|
|
||||||
limit: number | undefined
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
import { CurrencyDTO, PaymentProviderDTO, StoreDTO } from "@medusajs/types"
|
|
||||||
|
|
||||||
export type Store = StoreDTO & {
|
|
||||||
default_currency: CurrencyDTO | null
|
|
||||||
currencies?: CurrencyDTO[]
|
|
||||||
payment_providers?: PaymentProviderDTO[]
|
|
||||||
}
|
|
||||||
@@ -3,8 +3,8 @@ import {
|
|||||||
AdminCustomerGroupResponse,
|
AdminCustomerGroupResponse,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
import { z } from "zod"
|
import { z } from "zod"
|
||||||
import { CreateCustomerGroupSchema } from "../../v2-routes/customer-groups/customer-group-create/components/create-customer-group-form"
|
import { CreateCustomerGroupSchema } from "../../routes/customer-groups/customer-group-create/components/create-customer-group-form"
|
||||||
import { EditCustomerGroupSchema } from "../../v2-routes/customer-groups/customer-group-edit/components/edit-customer-group-form"
|
import { EditCustomerGroupSchema } from "../../routes/customer-groups/customer-group-edit/components/edit-customer-group-form"
|
||||||
import { deleteRequest, getRequest, postRequest } from "./common"
|
import { deleteRequest, getRequest, postRequest } from "./common"
|
||||||
|
|
||||||
async function retrieveCustomerGroup(id: string, query?: Record<string, any>) {
|
async function retrieveCustomerGroup(id: string, query?: Record<string, any>) {
|
||||||
|
|||||||
-6
@@ -1,4 +1,3 @@
|
|||||||
import Medusa from "@medusajs/medusa-js"
|
|
||||||
import { QueryClient } from "@tanstack/react-query"
|
import { QueryClient } from "@tanstack/react-query"
|
||||||
|
|
||||||
export const MEDUSA_BACKEND_URL = __BACKEND_URL__ ?? "http://localhost:9000"
|
export const MEDUSA_BACKEND_URL = __BACKEND_URL__ ?? "http://localhost:9000"
|
||||||
@@ -12,8 +11,3 @@ export const queryClient = new QueryClient({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
export const medusa = new Medusa({
|
|
||||||
baseUrl: MEDUSA_BACKEND_URL,
|
|
||||||
maxRetries: 1,
|
|
||||||
})
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
import { createContext } from "react"
|
|
||||||
import { Feature } from "./types"
|
|
||||||
|
|
||||||
type FeatureContextValue = {
|
|
||||||
isFeatureEnabled: (feature: Feature) => boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
export const FeatureContext = createContext<FeatureContextValue | null>(null)
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
import { useAdminStore } from "medusa-react"
|
|
||||||
import { PropsWithChildren, useEffect, useState } from "react"
|
|
||||||
import { FeatureContext } from "./feature-context"
|
|
||||||
import { Feature } from "./types"
|
|
||||||
|
|
||||||
export const FeatureProvider = ({ children }: PropsWithChildren) => {
|
|
||||||
const { store, isLoading } = useAdminStore()
|
|
||||||
const [features, setFeatures] = useState<Feature[]>([])
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (!store || isLoading) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const flags = store.feature_flags
|
|
||||||
.filter((f) => f.value === true)
|
|
||||||
.map((f) => f.key)
|
|
||||||
const modules = store.modules.map((m) => m.module)
|
|
||||||
const enabled = flags.concat(modules)
|
|
||||||
|
|
||||||
setFeatures(enabled as Feature[])
|
|
||||||
}, [store, isLoading])
|
|
||||||
|
|
||||||
function isFeatureEnabled(feature: Feature) {
|
|
||||||
return features.includes(feature)
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<FeatureContext.Provider value={{ isFeatureEnabled }}>
|
|
||||||
{children}
|
|
||||||
</FeatureContext.Provider>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
export { FeatureProvider } from "./feature-provider";
|
|
||||||
export { useFeature } from "./use-feature";
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
const featureFlags = [
|
|
||||||
"analytics",
|
|
||||||
"order_editing",
|
|
||||||
"product_categories",
|
|
||||||
"publishable_api_keys",
|
|
||||||
"sales_channels",
|
|
||||||
"tax_inclusive_pricing",
|
|
||||||
] as const
|
|
||||||
|
|
||||||
type FeatureFlag = (typeof featureFlags)[number]
|
|
||||||
|
|
||||||
const modules = ["inventory"] as const
|
|
||||||
|
|
||||||
type Module = (typeof modules)[number]
|
|
||||||
|
|
||||||
export type Feature = FeatureFlag | Module
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
import { useContext } from "react";
|
|
||||||
import { FeatureContext } from "./feature-context";
|
|
||||||
|
|
||||||
export const useFeature = () => {
|
|
||||||
const context = useContext(FeatureContext);
|
|
||||||
if (context === null) {
|
|
||||||
throw new Error("useFeature must be used within a FeatureProvider");
|
|
||||||
}
|
|
||||||
return context;
|
|
||||||
};
|
|
||||||
@@ -5,9 +5,9 @@ import {
|
|||||||
AdminProductCategoryResponse,
|
AdminProductCategoryResponse,
|
||||||
AdminTaxRateResponse,
|
AdminTaxRateResponse,
|
||||||
AdminTaxRegionResponse,
|
AdminTaxRegionResponse,
|
||||||
|
HttpTypes,
|
||||||
SalesChannelDTO,
|
SalesChannelDTO,
|
||||||
UserDTO,
|
UserDTO,
|
||||||
HttpTypes,
|
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
import { Outlet, RouteObject } from "react-router-dom"
|
import { Outlet, RouteObject } from "react-router-dom"
|
||||||
|
|
||||||
@@ -23,11 +23,11 @@ import { SettingsExtensions } from "./settings-extensions"
|
|||||||
export const RouteMap: RouteObject[] = [
|
export const RouteMap: RouteObject[] = [
|
||||||
{
|
{
|
||||||
path: "/login",
|
path: "/login",
|
||||||
lazy: () => import("../../v2-routes/login"),
|
lazy: () => import("../../routes/login"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/",
|
path: "/",
|
||||||
lazy: () => import("../../v2-routes/home"),
|
lazy: () => import("../../routes/home"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "*",
|
path: "*",
|
||||||
@@ -35,7 +35,7 @@ export const RouteMap: RouteObject[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/invite",
|
path: "/invite",
|
||||||
lazy: () => import("../../v2-routes/invite"),
|
lazy: () => import("../../routes/invite"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
element: <ProtectedRoute />,
|
element: <ProtectedRoute />,
|
||||||
@@ -53,70 +53,67 @@ export const RouteMap: RouteObject[] = [
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "",
|
path: "",
|
||||||
lazy: () => import("../../v2-routes/products/product-list"),
|
lazy: () => import("../../routes/products/product-list"),
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "create",
|
path: "create",
|
||||||
lazy: () =>
|
lazy: () => import("../../routes/products/product-create"),
|
||||||
import("../../v2-routes/products/product-create"),
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ":id",
|
path: ":id",
|
||||||
lazy: () => import("../../v2-routes/products/product-detail"),
|
lazy: () => import("../../routes/products/product-detail"),
|
||||||
handle: {
|
handle: {
|
||||||
crumb: (data: AdminProductsRes) => data.product.title,
|
crumb: (data: AdminProductsRes) => data.product.title,
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "edit",
|
path: "edit",
|
||||||
lazy: () => import("../../v2-routes/products/product-edit"),
|
lazy: () => import("../../routes/products/product-edit"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "sales-channels",
|
path: "sales-channels",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import("../../v2-routes/products/product-sales-channels"),
|
import("../../routes/products/product-sales-channels"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "attributes",
|
path: "attributes",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import("../../v2-routes/products/product-attributes"),
|
import("../../routes/products/product-attributes"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "organization",
|
path: "organization",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import("../../v2-routes/products/product-organization"),
|
import("../../routes/products/product-organization"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "media",
|
path: "media",
|
||||||
lazy: () =>
|
lazy: () => import("../../routes/products/product-media"),
|
||||||
import("../../v2-routes/products/product-media"),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "prices",
|
path: "prices",
|
||||||
lazy: () =>
|
lazy: () => import("../../routes/products/product-prices"),
|
||||||
import("../../v2-routes/products/product-prices"),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "options/create",
|
path: "options/create",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import("../../v2-routes/products/product-create-option"),
|
import("../../routes/products/product-create-option"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "options/:option_id/edit",
|
path: "options/:option_id/edit",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import("../../v2-routes/products/product-edit-option"),
|
import("../../routes/products/product-edit-option"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "variants/create",
|
path: "variants/create",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import("../../v2-routes/products/product-create-variant"),
|
import("../../routes/products/product-create-variant"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "variants/:variant_id/edit",
|
path: "variants/:variant_id/edit",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import("../../v2-routes/products/product-edit-variant"),
|
import("../../routes/products/product-edit-variant"),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -130,12 +127,11 @@ export const RouteMap: RouteObject[] = [
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "",
|
path: "",
|
||||||
lazy: () => import("../../v2-routes/categories/category-list"),
|
lazy: () => import("../../routes/categories/category-list"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ":id",
|
path: ":id",
|
||||||
lazy: () =>
|
lazy: () => import("../../routes/categories/category-detail"),
|
||||||
import("../../v2-routes/categories/category-detail"),
|
|
||||||
handle: {
|
handle: {
|
||||||
crumb: (data: AdminProductCategoryResponse) =>
|
crumb: (data: AdminProductCategoryResponse) =>
|
||||||
data.product_category.name,
|
data.product_category.name,
|
||||||
@@ -151,16 +147,16 @@ export const RouteMap: RouteObject[] = [
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "",
|
path: "",
|
||||||
lazy: () => import("../../v2-routes/orders/order-list"),
|
lazy: () => import("../../routes/orders/order-list"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ":id",
|
path: ":id",
|
||||||
lazy: () => import("../../v2-routes/orders/order-detail"),
|
lazy: () => import("../../routes/orders/order-detail"),
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "fulfillment",
|
path: "fulfillment",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import("../../v2-routes/orders/order-create-fulfillment"),
|
import("../../routes/orders/order-create-fulfillment"),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -174,17 +170,15 @@ export const RouteMap: RouteObject[] = [
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "",
|
path: "",
|
||||||
lazy: () => import("../../v2-routes/promotions/promotion-list"),
|
lazy: () => import("../../routes/promotions/promotion-list"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "create",
|
path: "create",
|
||||||
lazy: () =>
|
lazy: () => import("../../routes/promotions/promotion-create"),
|
||||||
import("../../v2-routes/promotions/promotion-create"),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ":id",
|
path: ":id",
|
||||||
lazy: () =>
|
lazy: () => import("../../routes/promotions/promotion-detail"),
|
||||||
import("../../v2-routes/promotions/promotion-detail"),
|
|
||||||
handle: {
|
handle: {
|
||||||
// TODO: Re-add type when it's available again
|
// TODO: Re-add type when it's available again
|
||||||
crumb: (data: any) => data.promotion?.code,
|
crumb: (data: any) => data.promotion?.code,
|
||||||
@@ -193,21 +187,17 @@ export const RouteMap: RouteObject[] = [
|
|||||||
{
|
{
|
||||||
path: "edit",
|
path: "edit",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import("../../routes/promotions/promotion-edit-details"),
|
||||||
"../../v2-routes/promotions/promotion-edit-details"
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "add-to-campaign",
|
path: "add-to-campaign",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import("../../routes/promotions/promotion-add-campaign"),
|
||||||
"../../v2-routes/promotions/promotion-add-campaign"
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ":ruleType/edit",
|
path: ":ruleType/edit",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import("../../v2-routes/promotions/common/edit-rules"),
|
import("../../routes/promotions/common/edit-rules"),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -219,34 +209,31 @@ export const RouteMap: RouteObject[] = [
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "",
|
path: "",
|
||||||
lazy: () => import("../../v2-routes/campaigns/campaign-list"),
|
lazy: () => import("../../routes/campaigns/campaign-list"),
|
||||||
children: [],
|
children: [],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "create",
|
path: "create",
|
||||||
lazy: () => import("../../v2-routes/campaigns/campaign-create"),
|
lazy: () => import("../../routes/campaigns/campaign-create"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ":id",
|
path: ":id",
|
||||||
lazy: () => import("../../v2-routes/campaigns/campaign-detail"),
|
lazy: () => import("../../routes/campaigns/campaign-detail"),
|
||||||
handle: { crumb: (data: any) => data.campaign.name },
|
handle: { crumb: (data: any) => data.campaign.name },
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "edit",
|
path: "edit",
|
||||||
lazy: () =>
|
lazy: () => import("../../routes/campaigns/campaign-edit"),
|
||||||
import("../../v2-routes/campaigns/campaign-edit"),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "edit-budget",
|
path: "edit-budget",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import("../../v2-routes/campaigns/campaign-budget-edit"),
|
import("../../routes/campaigns/campaign-budget-edit"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "add-promotions",
|
path: "add-promotions",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import("../../routes/campaigns/add-campaign-promotions"),
|
||||||
"../../v2-routes/campaigns/add-campaign-promotions"
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -260,20 +247,19 @@ export const RouteMap: RouteObject[] = [
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "",
|
path: "",
|
||||||
lazy: () =>
|
lazy: () => import("../../routes/collections/collection-list"),
|
||||||
import("../../v2-routes/collections/collection-list"),
|
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "create",
|
path: "create",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import("../../v2-routes/collections/collection-create"),
|
import("../../routes/collections/collection-create"),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ":id",
|
path: ":id",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import("../../v2-routes/collections/collection-detail"),
|
import("../../routes/collections/collection-detail"),
|
||||||
handle: {
|
handle: {
|
||||||
crumb: (data: AdminCollectionsRes) => data.collection.title,
|
crumb: (data: AdminCollectionsRes) => data.collection.title,
|
||||||
},
|
},
|
||||||
@@ -281,13 +267,13 @@ export const RouteMap: RouteObject[] = [
|
|||||||
{
|
{
|
||||||
path: "edit",
|
path: "edit",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import("../../v2-routes/collections/collection-edit"),
|
import("../../routes/collections/collection-edit"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "products",
|
path: "products",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import(
|
||||||
"../../v2-routes/collections/collection-add-products"
|
"../../routes/collections/collection-add-products"
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -302,40 +288,38 @@ export const RouteMap: RouteObject[] = [
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "",
|
path: "",
|
||||||
lazy: () => import("../../v2-routes/pricing/pricing-list"),
|
lazy: () => import("../../routes/pricing/pricing-list"),
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "create",
|
path: "create",
|
||||||
lazy: () =>
|
lazy: () => import("../../routes/pricing/pricing-create"),
|
||||||
import("../../v2-routes/pricing/pricing-create"),
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ":id",
|
path: ":id",
|
||||||
lazy: () => import("../../v2-routes/pricing/pricing-detail"),
|
lazy: () => import("../../routes/pricing/pricing-detail"),
|
||||||
handle: {
|
handle: {
|
||||||
crumb: (data: PriceListRes) => data.price_list.title,
|
crumb: (data: PriceListRes) => data.price_list.title,
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "edit",
|
path: "edit",
|
||||||
lazy: () => import("../../v2-routes/pricing/pricing-edit"),
|
lazy: () => import("../../routes/pricing/pricing-edit"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "configuration",
|
path: "configuration",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import("../../v2-routes/pricing/pricing-configuration"),
|
import("../../routes/pricing/pricing-configuration"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "products/add",
|
path: "products/add",
|
||||||
lazy: () =>
|
lazy: () => import("../../routes/pricing/pricing-products"),
|
||||||
import("../../v2-routes/pricing/pricing-products"),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "products/edit",
|
path: "products/edit",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import("../../v2-routes/pricing/pricing-products-prices"),
|
import("../../routes/pricing/pricing-products-prices"),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -349,18 +333,18 @@ export const RouteMap: RouteObject[] = [
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "",
|
path: "",
|
||||||
lazy: () => import("../../v2-routes/customers/customer-list"),
|
lazy: () => import("../../routes/customers/customer-list"),
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "create",
|
path: "create",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import("../../v2-routes/customers/customer-create"),
|
import("../../routes/customers/customer-create"),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ":id",
|
path: ":id",
|
||||||
lazy: () => import("../../v2-routes/customers/customer-detail"),
|
lazy: () => import("../../routes/customers/customer-detail"),
|
||||||
handle: {
|
handle: {
|
||||||
// Re-add type when it's available again
|
// Re-add type when it's available again
|
||||||
crumb: (data: any) => data.customer.email,
|
crumb: (data: any) => data.customer.email,
|
||||||
@@ -368,14 +352,13 @@ export const RouteMap: RouteObject[] = [
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "edit",
|
path: "edit",
|
||||||
lazy: () =>
|
lazy: () => import("../../routes/customers/customer-edit"),
|
||||||
import("../../v2-routes/customers/customer-edit"),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "add-customer-groups",
|
path: "add-customer-groups",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import(
|
||||||
"../../v2-routes/customers/customers-add-customer-group"
|
"../../routes/customers/customers-add-customer-group"
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -391,13 +374,13 @@ export const RouteMap: RouteObject[] = [
|
|||||||
{
|
{
|
||||||
path: "",
|
path: "",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import("../../v2-routes/customer-groups/customer-group-list"),
|
import("../../routes/customer-groups/customer-group-list"),
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "create",
|
path: "create",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import(
|
||||||
"../../v2-routes/customer-groups/customer-group-create"
|
"../../routes/customer-groups/customer-group-create"
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -405,9 +388,7 @@ export const RouteMap: RouteObject[] = [
|
|||||||
{
|
{
|
||||||
path: ":id",
|
path: ":id",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import("../../routes/customer-groups/customer-group-detail"),
|
||||||
"../../v2-routes/customer-groups/customer-group-detail"
|
|
||||||
),
|
|
||||||
handle: {
|
handle: {
|
||||||
crumb: (data: AdminCustomerGroupResponse) =>
|
crumb: (data: AdminCustomerGroupResponse) =>
|
||||||
data.customer_group.name,
|
data.customer_group.name,
|
||||||
@@ -417,14 +398,14 @@ export const RouteMap: RouteObject[] = [
|
|||||||
path: "edit",
|
path: "edit",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import(
|
||||||
"../../v2-routes/customer-groups/customer-group-edit"
|
"../../routes/customer-groups/customer-group-edit"
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "add-customers",
|
path: "add-customers",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import(
|
||||||
"../../v2-routes/customer-groups/customer-group-add-customers"
|
"../../routes/customer-groups/customer-group-add-customers"
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -440,13 +421,13 @@ export const RouteMap: RouteObject[] = [
|
|||||||
{
|
{
|
||||||
path: "",
|
path: "",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import("../../v2-routes/reservations/reservation-list"),
|
import("../../routes/reservations/reservation-list"),
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "create",
|
path: "create",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import(
|
||||||
"../../v2-routes/reservations/reservation-list/create-reservation"
|
"../../routes/reservations/reservation-list/create-reservation"
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -454,7 +435,7 @@ export const RouteMap: RouteObject[] = [
|
|||||||
{
|
{
|
||||||
path: ":id",
|
path: ":id",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import("../../v2-routes/reservations/reservation-detail"),
|
import("../../routes/reservations/reservation-detail"),
|
||||||
handle: {
|
handle: {
|
||||||
crumb: ({ reservation }: any) => {
|
crumb: ({ reservation }: any) => {
|
||||||
return (
|
return (
|
||||||
@@ -469,7 +450,7 @@ export const RouteMap: RouteObject[] = [
|
|||||||
path: "edit",
|
path: "edit",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import(
|
||||||
"../../v2-routes/reservations/reservation-detail/components/edit-reservation"
|
"../../routes/reservations/reservation-detail/components/edit-reservation"
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -484,12 +465,11 @@ export const RouteMap: RouteObject[] = [
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "",
|
path: "",
|
||||||
lazy: () => import("../../v2-routes/inventory/inventory-list"),
|
lazy: () => import("../../routes/inventory/inventory-list"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ":id",
|
path: ":id",
|
||||||
lazy: () =>
|
lazy: () => import("../../routes/inventory/inventory-detail"),
|
||||||
import("../../v2-routes/inventory/inventory-detail"),
|
|
||||||
handle: {
|
handle: {
|
||||||
crumb: (data: InventoryItemRes) =>
|
crumb: (data: InventoryItemRes) =>
|
||||||
data.inventory_item.title ?? data.inventory_item.sku,
|
data.inventory_item.title ?? data.inventory_item.sku,
|
||||||
@@ -499,41 +479,39 @@ export const RouteMap: RouteObject[] = [
|
|||||||
path: "edit",
|
path: "edit",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import(
|
||||||
"../../v2-routes/inventory/inventory-detail/components/edit-inventory-item"
|
"../../routes/inventory/inventory-detail/components/edit-inventory-item"
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "attributes",
|
path: "attributes",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import(
|
||||||
"../../v2-routes/inventory/inventory-detail/components/edit-inventory-item-attributes"
|
"../../routes/inventory/inventory-detail/components/edit-inventory-item-attributes"
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "locations",
|
path: "locations",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import(
|
||||||
"../../v2-routes/inventory/inventory-detail/components/manage-locations"
|
"../../routes/inventory/inventory-detail/components/manage-locations"
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "locations/:location_id",
|
path: "locations/:location_id",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import(
|
||||||
"../../v2-routes/inventory/inventory-detail/components/adjust-inventory"
|
"../../routes/inventory/inventory-detail/components/adjust-inventory"
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// TODO: create reservation
|
// TODO: create reservation
|
||||||
path: "reservations",
|
path: "reservations",
|
||||||
lazy: () =>
|
lazy: () => import("../../routes/customers/customer-edit"),
|
||||||
import("../../v2-routes/customers/customer-edit"),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// TODO: edit reservation
|
// TODO: edit reservation
|
||||||
path: "reservations/:reservation_id",
|
path: "reservations/:reservation_id",
|
||||||
lazy: () =>
|
lazy: () => import("../../routes/customers/customer-edit"),
|
||||||
import("../../v2-routes/customers/customer-edit"),
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -554,18 +532,18 @@ export const RouteMap: RouteObject[] = [
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
index: true,
|
index: true,
|
||||||
lazy: () => import("../../v2-routes/settings"),
|
lazy: () => import("../../routes/settings"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "profile",
|
path: "profile",
|
||||||
lazy: () => import("../../v2-routes/profile/profile-detail"),
|
lazy: () => import("../../routes/profile/profile-detail"),
|
||||||
handle: {
|
handle: {
|
||||||
crumb: () => "Profile",
|
crumb: () => "Profile",
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "edit",
|
path: "edit",
|
||||||
lazy: () => import("../../v2-routes/profile/profile-edit"),
|
lazy: () => import("../../routes/profile/profile-edit"),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -578,17 +556,17 @@ export const RouteMap: RouteObject[] = [
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "",
|
path: "",
|
||||||
lazy: () => import("../../v2-routes/regions/region-list"),
|
lazy: () => import("../../routes/regions/region-list"),
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "create",
|
path: "create",
|
||||||
lazy: () => import("../../v2-routes/regions/region-create"),
|
lazy: () => import("../../routes/regions/region-create"),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ":id",
|
path: ":id",
|
||||||
lazy: () => import("../../v2-routes/regions/region-detail"),
|
lazy: () => import("../../routes/regions/region-detail"),
|
||||||
handle: {
|
handle: {
|
||||||
crumb: (data: { region: HttpTypes.AdminRegion }) =>
|
crumb: (data: { region: HttpTypes.AdminRegion }) =>
|
||||||
data.region.name,
|
data.region.name,
|
||||||
@@ -596,12 +574,12 @@ export const RouteMap: RouteObject[] = [
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "edit",
|
path: "edit",
|
||||||
lazy: () => import("../../v2-routes/regions/region-edit"),
|
lazy: () => import("../../routes/regions/region-edit"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "countries/add",
|
path: "countries/add",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import("../../v2-routes/regions/region-add-countries"),
|
import("../../routes/regions/region-add-countries"),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -609,19 +587,18 @@ export const RouteMap: RouteObject[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "store",
|
path: "store",
|
||||||
lazy: () => import("../../v2-routes/store/store-detail"),
|
lazy: () => import("../../routes/store/store-detail"),
|
||||||
handle: {
|
handle: {
|
||||||
crumb: () => "Store",
|
crumb: () => "Store",
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "edit",
|
path: "edit",
|
||||||
lazy: () => import("../../v2-routes/store/store-edit"),
|
lazy: () => import("../../routes/store/store-edit"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "currencies",
|
path: "currencies",
|
||||||
lazy: () =>
|
lazy: () => import("../../routes/store/store-add-currencies"),
|
||||||
import("../../v2-routes/store/store-add-currencies"),
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -634,24 +611,24 @@ export const RouteMap: RouteObject[] = [
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "",
|
path: "",
|
||||||
lazy: () => import("../../v2-routes/users/user-list"),
|
lazy: () => import("../../routes/users/user-list"),
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "invite",
|
path: "invite",
|
||||||
lazy: () => import("../../v2-routes/users/user-invite"),
|
lazy: () => import("../../routes/users/user-invite"),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ":id",
|
path: ":id",
|
||||||
lazy: () => import("../../v2-routes/users/user-detail"),
|
lazy: () => import("../../routes/users/user-detail"),
|
||||||
handle: {
|
handle: {
|
||||||
crumb: (data: { user: UserDTO }) => data.user.email,
|
crumb: (data: { user: UserDTO }) => data.user.email,
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "edit",
|
path: "edit",
|
||||||
lazy: () => import("../../v2-routes/users/user-edit"),
|
lazy: () => import("../../routes/users/user-edit"),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -667,13 +644,13 @@ export const RouteMap: RouteObject[] = [
|
|||||||
{
|
{
|
||||||
path: "",
|
path: "",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import("../../v2-routes/sales-channels/sales-channel-list"),
|
import("../../routes/sales-channels/sales-channel-list"),
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "create",
|
path: "create",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import(
|
||||||
"../../v2-routes/sales-channels/sales-channel-create"
|
"../../routes/sales-channels/sales-channel-create"
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -681,7 +658,7 @@ export const RouteMap: RouteObject[] = [
|
|||||||
{
|
{
|
||||||
path: ":id",
|
path: ":id",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import("../../v2-routes/sales-channels/sales-channel-detail"),
|
import("../../routes/sales-channels/sales-channel-detail"),
|
||||||
handle: {
|
handle: {
|
||||||
crumb: (data: { sales_channel: SalesChannelDTO }) =>
|
crumb: (data: { sales_channel: SalesChannelDTO }) =>
|
||||||
data.sales_channel.name,
|
data.sales_channel.name,
|
||||||
@@ -690,15 +667,13 @@ export const RouteMap: RouteObject[] = [
|
|||||||
{
|
{
|
||||||
path: "edit",
|
path: "edit",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import("../../routes/sales-channels/sales-channel-edit"),
|
||||||
"../../v2-routes/sales-channels/sales-channel-edit"
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "add-products",
|
path: "add-products",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import(
|
||||||
"../../v2-routes/sales-channels/sales-channel-add-products"
|
"../../routes/sales-channels/sales-channel-add-products"
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -714,26 +689,25 @@ export const RouteMap: RouteObject[] = [
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "",
|
path: "",
|
||||||
lazy: () => import("../../v2-routes/shipping/location-list"),
|
lazy: () => import("../../routes/shipping/location-list"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "create",
|
path: "create",
|
||||||
lazy: () => import("../../v2-routes/shipping/location-create"),
|
lazy: () => import("../../routes/shipping/location-create"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ":location_id",
|
path: ":location_id",
|
||||||
lazy: () => import("../../v2-routes/shipping/location-details"),
|
lazy: () => import("../../routes/shipping/location-details"),
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "edit",
|
path: "edit",
|
||||||
lazy: () =>
|
lazy: () => import("../../routes/shipping/location-edit"),
|
||||||
import("../../v2-routes/shipping/location-edit"),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "sales-channels/edit",
|
path: "sales-channels/edit",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import(
|
||||||
"../../v2-routes/shipping/location-add-sales-channels"
|
"../../routes/shipping/location-add-sales-channels"
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -742,9 +716,7 @@ export const RouteMap: RouteObject[] = [
|
|||||||
{
|
{
|
||||||
path: "service-zones/create",
|
path: "service-zones/create",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import("../../routes/shipping/service-zone-create"),
|
||||||
"../../v2-routes/shipping/service-zone-create"
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "service-zone/:zone_id",
|
path: "service-zone/:zone_id",
|
||||||
@@ -752,15 +724,13 @@ export const RouteMap: RouteObject[] = [
|
|||||||
{
|
{
|
||||||
path: "edit",
|
path: "edit",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import("../../routes/shipping/service-zone-edit"),
|
||||||
"../../v2-routes/shipping/service-zone-edit"
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "edit-areas",
|
path: "edit-areas",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import(
|
||||||
"../../v2-routes/shipping/service-zone-areas-edit"
|
"../../routes/shipping/service-zone-areas-edit"
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -770,7 +740,7 @@ export const RouteMap: RouteObject[] = [
|
|||||||
path: "create",
|
path: "create",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import(
|
||||||
"../../v2-routes/shipping/shipping-options-create"
|
"../../routes/shipping/shipping-options-create"
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -780,14 +750,14 @@ export const RouteMap: RouteObject[] = [
|
|||||||
path: "edit",
|
path: "edit",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import(
|
||||||
"../../v2-routes/shipping/shipping-option-edit"
|
"../../routes/shipping/shipping-option-edit"
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "edit-pricing",
|
path: "edit-pricing",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import(
|
||||||
"../../v2-routes/shipping/shipping-options-edit-pricing"
|
"../../routes/shipping/shipping-options-edit-pricing"
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -813,14 +783,14 @@ export const RouteMap: RouteObject[] = [
|
|||||||
path: "",
|
path: "",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import(
|
||||||
"../../v2-routes/workflow-executions/workflow-execution-list"
|
"../../routes/workflow-executions/workflow-execution-list"
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ":id",
|
path: ":id",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import(
|
||||||
"../../v2-routes/workflow-executions/workflow-execution-detail"
|
"../../routes/workflow-executions/workflow-execution-detail"
|
||||||
),
|
),
|
||||||
handle: {
|
handle: {
|
||||||
crumb: (data: { workflow: any }) => {
|
crumb: (data: { workflow: any }) => {
|
||||||
@@ -845,14 +815,14 @@ export const RouteMap: RouteObject[] = [
|
|||||||
path: "",
|
path: "",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import(
|
||||||
"../../v2-routes/shipping-profiles/shipping-profiles-list"
|
"../../routes/shipping-profiles/shipping-profiles-list"
|
||||||
),
|
),
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "create",
|
path: "create",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import(
|
||||||
"../../v2-routes/shipping-profiles/shipping-profile-create"
|
"../../routes/shipping-profiles/shipping-profile-create"
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -861,7 +831,7 @@ export const RouteMap: RouteObject[] = [
|
|||||||
path: ":id",
|
path: ":id",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import(
|
||||||
"../../v2-routes/shipping-profiles/shipping-profile-detail"
|
"../../routes/shipping-profiles/shipping-profile-detail"
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -881,14 +851,14 @@ export const RouteMap: RouteObject[] = [
|
|||||||
path: "",
|
path: "",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import(
|
||||||
"../../v2-routes/api-key-management/api-key-management-list"
|
"../../routes/api-key-management/api-key-management-list"
|
||||||
),
|
),
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "create",
|
path: "create",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import(
|
||||||
"../../v2-routes/api-key-management/api-key-management-create"
|
"../../routes/api-key-management/api-key-management-create"
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -899,7 +869,7 @@ export const RouteMap: RouteObject[] = [
|
|||||||
path: ":id",
|
path: ":id",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import(
|
||||||
"../../v2-routes/api-key-management/api-key-management-detail"
|
"../../routes/api-key-management/api-key-management-detail"
|
||||||
),
|
),
|
||||||
handle: {
|
handle: {
|
||||||
crumb: (data: AdminApiKeyResponse) => {
|
crumb: (data: AdminApiKeyResponse) => {
|
||||||
@@ -911,14 +881,14 @@ export const RouteMap: RouteObject[] = [
|
|||||||
path: "edit",
|
path: "edit",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import(
|
||||||
"../../v2-routes/api-key-management/api-key-management-edit"
|
"../../routes/api-key-management/api-key-management-edit"
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "sales-channels",
|
path: "sales-channels",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import(
|
||||||
"../../v2-routes/api-key-management/api-key-management-sales-channels"
|
"../../routes/api-key-management/api-key-management-sales-channels"
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -940,14 +910,14 @@ export const RouteMap: RouteObject[] = [
|
|||||||
path: "",
|
path: "",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import(
|
||||||
"../../v2-routes/api-key-management/api-key-management-list"
|
"../../routes/api-key-management/api-key-management-list"
|
||||||
),
|
),
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "create",
|
path: "create",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import(
|
||||||
"../../v2-routes/api-key-management/api-key-management-create"
|
"../../routes/api-key-management/api-key-management-create"
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -958,7 +928,7 @@ export const RouteMap: RouteObject[] = [
|
|||||||
path: ":id",
|
path: ":id",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import(
|
||||||
"../../v2-routes/api-key-management/api-key-management-detail"
|
"../../routes/api-key-management/api-key-management-detail"
|
||||||
),
|
),
|
||||||
handle: {
|
handle: {
|
||||||
crumb: (data: AdminApiKeyResponse) => {
|
crumb: (data: AdminApiKeyResponse) => {
|
||||||
@@ -970,7 +940,7 @@ export const RouteMap: RouteObject[] = [
|
|||||||
path: "edit",
|
path: "edit",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import(
|
import(
|
||||||
"../../v2-routes/api-key-management/api-key-management-edit"
|
"../../routes/api-key-management/api-key-management-edit"
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -986,19 +956,18 @@ export const RouteMap: RouteObject[] = [
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "",
|
path: "",
|
||||||
lazy: () => import("../../v2-routes/taxes/tax-region-list"),
|
lazy: () => import("../../routes/taxes/tax-region-list"),
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "create",
|
path: "create",
|
||||||
lazy: () =>
|
lazy: () => import("../../routes/taxes/tax-region-create"),
|
||||||
import("../../v2-routes/taxes/tax-region-create"),
|
|
||||||
children: [],
|
children: [],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ":id",
|
path: ":id",
|
||||||
lazy: () => import("../../v2-routes/taxes/tax-region-detail"),
|
lazy: () => import("../../routes/taxes/tax-region-detail"),
|
||||||
handle: {
|
handle: {
|
||||||
crumb: (data: AdminTaxRegionResponse) => {
|
crumb: (data: AdminTaxRegionResponse) => {
|
||||||
return data.tax_region.country_code
|
return data.tax_region.country_code
|
||||||
@@ -1008,12 +977,12 @@ export const RouteMap: RouteObject[] = [
|
|||||||
{
|
{
|
||||||
path: "create-default",
|
path: "create-default",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import("../../v2-routes/taxes/tax-province-create"),
|
import("../../routes/taxes/tax-province-create"),
|
||||||
children: [],
|
children: [],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "create-override",
|
path: "create-override",
|
||||||
lazy: () => import("../../v2-routes/taxes/tax-rate-create"),
|
lazy: () => import("../../routes/taxes/tax-rate-create"),
|
||||||
children: [],
|
children: [],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1025,7 +994,7 @@ export const RouteMap: RouteObject[] = [
|
|||||||
{
|
{
|
||||||
path: "edit",
|
path: "edit",
|
||||||
lazy: () =>
|
lazy: () =>
|
||||||
import("../../v2-routes/taxes/tax-rate-edit"),
|
import("../../routes/taxes/tax-rate-edit"),
|
||||||
handle: {
|
handle: {
|
||||||
crumb: (data: AdminTaxRateResponse) => {
|
crumb: (data: AdminTaxRateResponse) => {
|
||||||
return data.tax_rate.code
|
return data.tax_rate.code
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ import { LoaderFunctionArgs } from "react-router-dom"
|
|||||||
import { AdminApiKeyResponse } from "@medusajs/types"
|
import { AdminApiKeyResponse } from "@medusajs/types"
|
||||||
import { apiKeysQueryKeys } from "../../../hooks/api/api-keys"
|
import { apiKeysQueryKeys } from "../../../hooks/api/api-keys"
|
||||||
import { client } from "../../../lib/client"
|
import { client } from "../../../lib/client"
|
||||||
import { queryClient } from "../../../lib/medusa"
|
import { queryClient } from "../../../lib/query-client"
|
||||||
|
|
||||||
const apiKeyDetailQuery = (id: string) => ({
|
const apiKeyDetailQuery = (id: string) => ({
|
||||||
queryKey: apiKeysQueryKeys.detail(id),
|
queryKey: apiKeysQueryKeys.detail(id),
|
||||||
+3
-3
@@ -1,9 +1,9 @@
|
|||||||
import { Response } from "@medusajs/medusa-js"
|
|
||||||
import { AdminCampaignResponse } from "@medusajs/types"
|
import { AdminCampaignResponse } from "@medusajs/types"
|
||||||
import { LoaderFunctionArgs } from "react-router-dom"
|
import { LoaderFunctionArgs } from "react-router-dom"
|
||||||
|
|
||||||
import { campaignsQueryKeys } from "../../../hooks/api/campaigns"
|
import { campaignsQueryKeys } from "../../../hooks/api/campaigns"
|
||||||
import { client } from "../../../lib/client"
|
import { client } from "../../../lib/client"
|
||||||
import { queryClient } from "../../../lib/medusa"
|
import { queryClient } from "../../../lib/query-client"
|
||||||
|
|
||||||
const campaignDetailQuery = (id: string) => ({
|
const campaignDetailQuery = (id: string) => ({
|
||||||
queryKey: campaignsQueryKeys.detail(id),
|
queryKey: campaignsQueryKeys.detail(id),
|
||||||
@@ -18,7 +18,7 @@ export const campaignLoader = async ({ params }: LoaderFunctionArgs) => {
|
|||||||
const query = campaignDetailQuery(id!)
|
const query = campaignDetailQuery(id!)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
queryClient.getQueryData<Response<AdminCampaignResponse>>(query.queryKey) ??
|
queryClient.getQueryData<AdminCampaignResponse>(query.queryKey) ??
|
||||||
(await queryClient.fetchQuery(query))
|
(await queryClient.fetchQuery(query))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user