mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-07 07:55:16 +02:00
fix: use NEXT_PUBLIC_BACKEND_URL if provided
This commit is contained in:
parent
09fb7d314f
commit
0908df73f8
1 changed files with 12 additions and 2 deletions
|
|
@ -57,6 +57,15 @@ import {
|
|||
} from "@/components/ui/table";
|
||||
import { useAuth } from "@/lib/auth";
|
||||
|
||||
const INBOUND_WEBHOOK_PATH = "/api/v1/telephony/inbound/run";
|
||||
|
||||
function getInboundWebhookUrl(): string {
|
||||
const backendUrl =
|
||||
process.env.NEXT_PUBLIC_BACKEND_URL ||
|
||||
(typeof window !== "undefined" ? window.location.origin : "");
|
||||
return `${backendUrl}${INBOUND_WEBHOOK_PATH}`;
|
||||
}
|
||||
|
||||
export default function TelephonyConfigurationDetailPage() {
|
||||
const router = useRouter();
|
||||
const params = useParams<{ configId: string }>();
|
||||
|
|
@ -255,16 +264,17 @@ export default function TelephonyConfigurationDetailPage() {
|
|||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
const url = `${typeof window !== "undefined" ? window.location.origin : ""}/api/v1/telephony/inbound/run`;
|
||||
const url = getInboundWebhookUrl();
|
||||
navigator.clipboard
|
||||
.writeText(url)
|
||||
.then(() => toast.success("Inbound webhook URL copied"))
|
||||
.catch(() => toast.error("Failed to copy URL"));
|
||||
}}
|
||||
title="Click to copy inbound webhook URL"
|
||||
aria-label="Copy inbound webhook URL"
|
||||
className="inline-flex items-center gap-1 self-start rounded font-mono text-xs text-muted-foreground hover:text-foreground"
|
||||
>
|
||||
<span className="truncate">/api/v1/telephony/inbound/run</span>
|
||||
<span className="truncate">{getInboundWebhookUrl()}</span>
|
||||
<Copy className="h-3 w-3 shrink-0" />
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue