Fix share url.

This commit is contained in:
Brian Cao 2026-02-05 09:35:29 -08:00
parent 9d6bb64c3d
commit 397796cfff

View file

@ -40,10 +40,7 @@ export function ShareEditForm({
const isEditing = !!shareId; const isEditing = !!shareId;
const getUrl = (slug: string) => { const getUrl = (slug: string) => {
if (cloudMode) { return `${cloudMode ? process.env.cloudUrl : window?.location.origin}${process.env.basePath || ''}/share/${slug}`;
return `${process.env.cloudUrl}/share/${slug}`;
}
return `${window?.location.origin}${process.env.basePath || ''}/share/${slug}`;
}; };
useEffect(() => { useEffect(() => {
@ -74,9 +71,16 @@ export function ShareEditForm({
try { try {
if (isEditing) { if (isEditing) {
await post(`/share/id/${shareId}`, { name: data.name, slug: share.slug, parameters }); await post(`/share/id/${shareId}`, {
name: data.name,
slug: share.slug,
parameters,
});
} else { } else {
await post(`/websites/${websiteId}/shares`, { name: data.name, parameters }); await post(`/websites/${websiteId}/shares`, {
name: data.name,
parameters,
});
} }
touch('shares'); touch('shares');
onSave?.(); onSave?.();