mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-07-19 11:41:04 +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";
|
} from "@/components/ui/table";
|
||||||
import { useAuth } from "@/lib/auth";
|
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() {
|
export default function TelephonyConfigurationDetailPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const params = useParams<{ configId: string }>();
|
const params = useParams<{ configId: string }>();
|
||||||
|
|
@ -255,16 +264,17 @@ export default function TelephonyConfigurationDetailPage() {
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
const url = `${typeof window !== "undefined" ? window.location.origin : ""}/api/v1/telephony/inbound/run`;
|
const url = getInboundWebhookUrl();
|
||||||
navigator.clipboard
|
navigator.clipboard
|
||||||
.writeText(url)
|
.writeText(url)
|
||||||
.then(() => toast.success("Inbound webhook URL copied"))
|
.then(() => toast.success("Inbound webhook URL copied"))
|
||||||
.catch(() => toast.error("Failed to copy URL"));
|
.catch(() => toast.error("Failed to copy URL"));
|
||||||
}}
|
}}
|
||||||
title="Click to copy inbound webhook 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"
|
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" />
|
<Copy className="h-3 w-3 shrink-0" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue