fix(admin-next,types): fixes order page from breaking in admin server (#8730)
This commit is contained in:
1 parent
f9749c5df6
commit
02c6574e01
5 files changed
+25
-4
No files matched your search
@@ -18,6 +18,7 @@ export async function getViteConfig(
|
|||||||
const root = path.resolve(__dirname, "./")
|
const root = path.resolve(__dirname, "./")
|
||||||
|
|
||||||
const backendUrl = options.backendUrl ?? ""
|
const backendUrl = options.backendUrl ?? ""
|
||||||
|
const storefrontUrl = options.storefrontUrl ?? ""
|
||||||
|
|
||||||
const baseConfig: InlineConfig = {
|
const baseConfig: InlineConfig = {
|
||||||
root,
|
root,
|
||||||
@@ -33,6 +34,7 @@ export async function getViteConfig(
|
|||||||
define: {
|
define: {
|
||||||
__BASE__: JSON.stringify(options.path),
|
__BASE__: JSON.stringify(options.path),
|
||||||
__BACKEND_URL__: JSON.stringify(backendUrl),
|
__BACKEND_URL__: JSON.stringify(backendUrl),
|
||||||
|
__STOREFRONT_URL__: JSON.stringify(storefrontUrl),
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
fs: {
|
fs: {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { AdminOptions } from "@medusajs/types"
|
import { AdminOptions } from "@medusajs/types"
|
||||||
|
|
||||||
export type BundlerOptions = Required<Pick<AdminOptions, "outDir" | "path">> &
|
export type BundlerOptions = Required<Pick<AdminOptions, "outDir" | "path">> &
|
||||||
Pick<AdminOptions, "vite" | "backendUrl"> & {
|
Pick<AdminOptions, "vite" | "backendUrl" | "storefrontUrl"> & {
|
||||||
sources?: string[]
|
sources?: string[]
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
export const MEDUSA_STOREFRONT_URL =
|
||||||
|
__STOREFRONT_URL__ ?? "http://localhost:8000"
|
||||||
+4
-3
@@ -5,8 +5,7 @@ import copy from "copy-to-clipboard"
|
|||||||
import React, { useState } from "react"
|
import React, { useState } from "react"
|
||||||
import { useTranslation } from "react-i18next"
|
import { useTranslation } from "react-i18next"
|
||||||
import { getStylizedAmount } from "../../../../../lib/money-amount-helpers"
|
import { getStylizedAmount } from "../../../../../lib/money-amount-helpers"
|
||||||
|
import { MEDUSA_STOREFRONT_URL } from "../../../../../lib/storefront"
|
||||||
export const MEDUSA_BACKEND_URL = __STOREFRONT_URL__ ?? "http://localhost:8000"
|
|
||||||
|
|
||||||
type CopyPaymentLinkProps = {
|
type CopyPaymentLinkProps = {
|
||||||
paymentCollection: AdminPaymentCollection
|
paymentCollection: AdminPaymentCollection
|
||||||
@@ -31,7 +30,9 @@ const CopyPaymentLink = React.forwardRef<any, CopyPaymentLinkProps>(
|
|||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
|
|
||||||
setDone(true)
|
setDone(true)
|
||||||
copy(`${MEDUSA_BACKEND_URL}/payment-collection/${paymentCollection.id}`)
|
copy(
|
||||||
|
`${MEDUSA_STOREFRONT_URL}/payment-collection/${paymentCollection.id}`
|
||||||
|
)
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setDone(false)
|
setDone(false)
|
||||||
|
|||||||
@@ -79,6 +79,22 @@ export type AdminOptions = {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
backendUrl?: string
|
backendUrl?: string
|
||||||
|
/**
|
||||||
|
* The URL of your Medusa storefront application. This will help generate links from the admin
|
||||||
|
* to provide to customers to complete any processes
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```js title="medusa-config.js"
|
||||||
|
* module.exports = defineConfig({
|
||||||
|
* admin: {
|
||||||
|
* storefrontUrl: process.env.MEDUSA_STOREFRONT_URL ||
|
||||||
|
* "http://localhost:9000"
|
||||||
|
* },
|
||||||
|
* // ...
|
||||||
|
* })
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
storefrontUrl?: string
|
||||||
/**
|
/**
|
||||||
* Configure the Vite configuration for the admin dashboard. This function receives the default Vite configuration
|
* Configure the Vite configuration for the admin dashboard. This function receives the default Vite configuration
|
||||||
* and returns the modified configuration. The default value is `undefined`.
|
* and returns the modified configuration. The default value is `undefined`.
|
||||||
|
|||||||
Reference in new issue
Block a user