Skip to content

Commit dd4866a

Browse files
authored
Merge pull request #868 from karrioapi/bugfix/order-menu-navigation
2 parents d63409e + 82d0b8f commit dd4866a

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

packages/ui/components/order-menu.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ import React, { useState } from "react";
1111
import { useAPIMetadata } from "@karrio/hooks/api-metadata";
1212
import { useOrderMutation } from "@karrio/hooks/order";
1313
import { useRouter } from "next/navigation";
14-
import { useAppMode } from "@karrio/hooks/app-mode";
1514
import { useToast } from "@karrio/ui/hooks/use-toast";
16-
import { url$ } from "@karrio/lib";
15+
import { url$, p } from "@karrio/lib";
1716
import {
1817
DropdownMenu,
1918
DropdownMenuContent,
@@ -35,7 +34,6 @@ export const OrderMenu = ({
3534
isViewing,
3635
}: OrderMenuComponent): JSX.Element => {
3736
const router = useRouter();
38-
const { basePath } = useAppMode();
3937
const { references } = useAPIMetadata();
4038
const mutation = useOrderMutation();
4139
const { toast } = useToast();
@@ -59,7 +57,7 @@ export const OrderMenu = ({
5957
description: "Taking you to view order details.",
6058
});
6159

62-
router.push(basePath + "/orders/" + order.id);
60+
router.push(p`/orders/${order.id}`);
6361
};
6462

6563
const navigateToCreateLabel = (_: React.MouseEvent) => {
@@ -68,7 +66,7 @@ export const OrderMenu = ({
6866
description: "Taking you to create a label for this order.",
6967
});
7068

71-
router.push(`${basePath}/orders/create_label?shipment_id=${computeShipmentId(order)}&order_id=${order?.id}`);
69+
router.push(p`/orders/create_label?shipment_id=${computeShipmentId(order)}&order_id=${order?.id}`);
7270
};
7371

7472
const navigateToEditOrder = (_: React.MouseEvent) => {
@@ -77,7 +75,7 @@ export const OrderMenu = ({
7775
description: "Taking you to edit this draft order.",
7876
});
7977

80-
router.push(`${basePath}/draft_orders/${order?.id}`);
78+
router.push(p`/draft_orders/${order?.id}`);
8179
};
8280

8381
const cancelOrder = (order: OrderType) => async () => {

0 commit comments

Comments
 (0)