Oli Juhl
2024-05-23 12:58:59 +02:00
committed by GitHub
parent 37ae87fe9b
commit 05077bab32
2 changed files with 22 additions and 4 deletions

View File

@@ -7,15 +7,15 @@ import { currencies } from "./currencies"
import { customerGroups } from "./customer-groups"
import { customers } from "./customers"
import { fulfillmentProviders } from "./fulfillment-providers"
import { fulfillments } from "./fulfillments"
import { inventoryItems } from "./inventory"
import { invites } from "./invites"
import { orders } from "./orders"
import { payments } from "./payments"
import { priceLists } from "./price-lists"
import { productTypes } from "./product-types"
import { products } from "./products"
import { promotions } from "./promotions"
import { orders } from "./orders"
import { fulfillments } from "./fulfillments"
import { reservations } from "./reservations"
import { salesChannels } from "./sales-channels"
import { shippingOptions } from "./shipping-options"
@@ -27,6 +27,8 @@ import { taxes } from "./taxes"
import { users } from "./users"
import { workflowExecutions } from "./workflow-executions"
export const backendUrl = __BACKEND_URL__ ?? "http://localhost:9000"
export const client = {
apiKeys: apiKeys,
campaigns: campaigns,
@@ -58,7 +60,7 @@ export const client = {
}
export const sdk = new Medusa({
baseUrl: __BACKEND_URL__ ?? "http://localhost:9000",
baseUrl: backendUrl,
auth: {
type: "session",
},

View File

@@ -1,5 +1,5 @@
import { zodResolver } from "@hookform/resolvers/zod"
import { ArrowPath, Trash } from "@medusajs/icons"
import { ArrowPath, Link, Trash } from "@medusajs/icons"
import { InviteDTO } from "@medusajs/types"
import {
Alert,
@@ -22,6 +22,7 @@ import { ActionMenu } from "../../../../../components/common/action-menu"
import { useDataTable } from "../../../../../hooks/use-data-table"
import { Form } from "../../../../../components/common/form"
import { RouteFocusModal } from "../../../../../components/route-modal"
import copy from "copy-to-clipboard"
import {
useCreateInvite,
useDeleteInvite,
@@ -30,6 +31,7 @@ import {
} from "../../../../../hooks/api/invites"
import { DataTable } from "../../../../../components/table/data-table"
import { useUserInviteTableQuery } from "../../../../../hooks/table/query/use-user-invite-table-query"
import { backendUrl } from "../../../../../lib/client"
import { isFetchError } from "../../../../../lib/is-fetch-error.ts"
const InviteUserSchema = zod.object({
@@ -203,6 +205,11 @@ const InviteActions = ({ invite }: { invite: InviteDTO }) => {
await resendAsync()
}
const handleCopyInviteLink = () => {
const inviteUrl = `${backendUrl}/app/invite?token=${invite.token}`
copy(inviteUrl)
}
return (
<ActionMenu
groups={[
@@ -215,6 +222,15 @@ const InviteActions = ({ invite }: { invite: InviteDTO }) => {
},
],
},
{
actions: [
{
icon: <Link />,
label: t("users.copyInviteLink"),
onClick: handleCopyInviteLink,
},
],
},
{
actions: [
{