fix(dashboard,medusa): Minor clean-up of admin v2 (#7257)

This commit is contained in:
Oli Juhl
2024-05-07 09:39:42 +02:00
committed by GitHub
parent 14d15df866
commit 8b61dccd0f
7 changed files with 21 additions and 26 deletions

View File

@@ -87,10 +87,11 @@ const useCoreRoutes = (): Omit<NavItemProps, "pathname">[] => {
label: t("orders.domain"), label: t("orders.domain"),
to: "/orders", to: "/orders",
items: [ items: [
{ // TODO: Enable when domin is introduced
label: t("draftOrders.domain"), // {
to: "/draft-orders", // label: t("draftOrders.domain"),
}, // to: "/draft-orders",
// },
], ],
}, },
{ {
@@ -98,18 +99,20 @@ const useCoreRoutes = (): Omit<NavItemProps, "pathname">[] => {
label: t("products.domain"), label: t("products.domain"),
to: "/products", to: "/products",
items: [ items: [
{ // TODO: Enable when domin is introduced
label: t("collections.domain"), // {
to: "/collections", // label: t("collections.domain"),
}, // to: "/collections",
// },
{ {
label: t("categories.domain"), label: t("categories.domain"),
to: "/categories", to: "/categories",
}, },
{ // TODO: Enable when domin is introduced
label: t("giftCards.domain"), // {
to: "/gift-cards", // label: t("giftCards.domain"),
}, // to: "/gift-cards",
// },
], ],
}, },
{ {

View File

@@ -37,18 +37,10 @@ const useSettingRoutes = (): NavItemProps[] => {
label: t("regions.domain"), label: t("regions.domain"),
to: "/settings/regions", to: "/settings/regions",
}, },
{
label: t("returnReasons.domain"),
to: "/settings/return-reasons",
},
{ {
label: "Taxes", label: "Taxes",
to: "/settings/taxes", to: "/settings/taxes",
}, },
{
label: "Locations",
to: "/settings/locations",
},
{ {
label: t("salesChannels.domain"), label: t("salesChannels.domain"),
to: "/settings/sales-channels", to: "/settings/sales-channels",

View File

@@ -135,7 +135,7 @@ export const useAddCustomersToGroup = (
options?: UseMutationOptions< options?: UseMutationOptions<
AdminCustomerGroupResponse, AdminCustomerGroupResponse,
Error, Error,
{ customer_ids: { id: string }[] } { customer_ids: string[] }
> >
) => { ) => {
return useMutation({ return useMutation({

View File

@@ -50,7 +50,7 @@ async function deleteCustomerGroup(id: string) {
async function batchAddCustomers( async function batchAddCustomers(
id: string, id: string,
payload: { customer_ids: { id: string }[] } payload: { customer_ids: string[] }
) { ) {
return postRequest<AdminCustomerGroupResponse>( return postRequest<AdminCustomerGroupResponse>(
`/admin/customer-groups/${id}/customers`, `/admin/customer-groups/${id}/customers`,

View File

@@ -347,7 +347,7 @@ export const RouteMap: RouteObject[] = [
path: "create", path: "create",
lazy: () => lazy: () =>
import( import(
"../../v2-routes/reservations/reservation-list/create-reservation" "../../v2-routes/customer-groups/customer-group-create"
), ),
}, },
], ],

View File

@@ -105,7 +105,7 @@ export const AddCustomersForm = ({
const handleSubmit = form.handleSubmit(async (data) => { const handleSubmit = form.handleSubmit(async (data) => {
await mutateAsync( await mutateAsync(
{ {
customer_ids: data.customer_ids.map((id) => ({ id })), customer_ids: data.customer_ids,
}, },
{ {
onSuccess: () => { onSuccess: () => {

View File

@@ -55,8 +55,8 @@ export type AdminUpdatePriceListPriceType = z.infer<
export const AdminCreatePriceList = z.object({ export const AdminCreatePriceList = z.object({
title: z.string(), title: z.string(),
description: z.string(), description: z.string(),
starts_at: z.string().optional(), starts_at: z.union([z.string(), z.null()]).optional(),
ends_at: z.string().optional(), ends_at: z.union([z.string(), z.null()]).optional(),
status: z.nativeEnum(PriceListStatus).optional(), status: z.nativeEnum(PriceListStatus).optional(),
type: z.nativeEnum(PriceListType).optional(), type: z.nativeEnum(PriceListType).optional(),
rules: z.record(z.string(), z.array(z.string())).optional(), rules: z.record(z.string(), z.array(z.string())).optional(),